Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Get total by 1st dim when using calc dim and rank

Hello Community,

Please find attached a sample qvw.

I'd like to get the total number of employees within country.

The usual count(distinct total <Country> Emp) gives same result as count(distinct Emp).

I tried using a sort of sum(aggr(count())) but it's giving correct result on one line, the 2nd is 0.

How to get it correctly on all lines ?

Thx.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Gysbert_Wassenaar

Maybe sum(aggr(count(DISTINCT Emp),Country,Reason))


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

It's giving same value as the first expression, which is the total employees associated with the top 2 reasons displayed.

I want to get the total by country which is 4 for C1, 4 for C2, 6 for C2.

Thx 4 your suggestion.

Gysbert_Wassenaar

See attached qvw.


talk is cheap, supply exceeds demand
Not applicable
Author

Awesome !

I just added a case with dimensionality() to get the total employees if I check partial sum on country.

if(dimensionality() = 0, count(total distinct Emp), your expression)

Many thx for your help Gysbert.