Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Average of count of users

Hi

I have a column called Emulator, i need to display a bar chart , with the average count of distinct users by emulator value

i have tried writing the expression Avg(count(distinct(user_name))) , but i get a syntax error?

what is the correct way to write this?

Thank you!

1 Solution

Accepted Solutions
vgutkovsky
Master II
Master II

Well, you can't have an aggregation function within an aggregation function--hence the syntax error. Also, you have too many parentheses there; user_name should not be surrounded by parantheses. I'm not sure I understand your data, but if you want to get a percentage, you would need to do a count(distinct) divided by a count(distinct total). Otherwise, you would need to used advanced aggregation, something like: avg(aggr(count(distinct user_name),Emulator))

Regards,

View solution in original post

5 Replies
vgutkovsky
Master II
Master II

Well, you can't have an aggregation function within an aggregation function--hence the syntax error. Also, you have too many parentheses there; user_name should not be surrounded by parantheses. I'm not sure I understand your data, but if you want to get a percentage, you would need to do a count(distinct) divided by a count(distinct total). Otherwise, you would need to used advanced aggregation, something like: avg(aggr(count(distinct user_name),Emulator))

Regards,

Not applicable
Author

Hi,

As per understanding of the problem, Please find the attached document.

Regards,

Ravi

Anonymous
Not applicable
Author

I have tried using the expression avg(aggr(count(distinct user_name),Emulator)), but the chart display nodatatodisplay message.

Anonymous
Not applicable
Author

Could you please let me know what is Rank here , i dont see the excel file in which you had your sample data.

Anonymous
Not applicable
Author

Thankyou , avg(aggr(count(distinct user_name),emulator)) gave me right answer, my expression had a typo earlier.