Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
lord_zeus
Partner - Contributor III
Partner - Contributor III

Calculate dimension

Hello! 

My colleague has a problem with which I could not help him. Suppose we have a table:

user_idcountryatr1atr2
1RU166
2US155
3RU155
3RU277
2US288

 

He want to count how many times user_id occurs in table (name it "#frequency"), and after that use the result of it and use like dimention and calculate how many user_id occurs in what #frequency.

Result must be somting like this:

#frequency#users
11
22

 

The problem is: if we select atr1 = 1, the result will be like 

#frequency#users
13

So, i cant calculate it in script, because dimention #frequency will change when in choose something.

Maybe I don't see simple solution?

Labels (1)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@lord_zeus  if you select atr1 = 1 normaly what is the expected output ?

for me 3 is correct !

in dimension :

=aggr(count(user_id),user_id)

Expression:

=count(distinct user_id)

 

output:

Capture.PNG

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

4 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 
short one , 
for dimension use this 

class(aggr(count(user_id),user_id),1)

expression:

count(distinct user_id)

 

Taoufiq_Zarra

@lord_zeus  if you select atr1 = 1 normaly what is the expected output ?

for me 3 is correct !

in dimension :

=aggr(count(user_id),user_id)

Expression:

=count(distinct user_id)

 

output:

Capture.PNG

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Taoufiq_Zarra

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
lord_zeus
Partner - Contributor III
Partner - Contributor III
Author

Guys, thanks! Both answers are correct, but for my task, Taoufiq_Zarra will give the most correct answear.