Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
GnomeGuy
Contributor II
Contributor II

Count after Aggregating with Condition

Hello all , 

i have this logic which i am trying to put in a KPI Chart and Master Measure :

Counting how many days where the average coconut sold per hour is greater than 100. My data have columns

Date | Hour | Fruit Name | Value

This works :

Count(Aggr(Avg({$<[Fruit Name]={"Coconut"}>}[Value]),[Date ])) which gives me 61 since there are 61 days

What i want to show is count how many days have average values > 100 which i am not sure where to add in the set analysis

Appreciate any help given.

Best regards.

Labels (2)
1 Solution

Accepted Solutions
GnomeGuy
Contributor II
Contributor II
Author

Thank you for your reply but your code does not work for me.

However, i did managed to solve it below. Not the best but i did get what i wanted.

 

Count(If(Aggr(Avg({$<[Fruit Name]={"Coconut"}>}[Value]),[Date]) > 100,'Yes',Null()))

View solution in original post

2 Replies
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

Count(aggr(avg({<[Fruit Name]={"=avg({<[Fruit Name]={'Coconut'}>}Value)>100"}>}Value),Date))

Thanks and regards,

Arthur Fong

GnomeGuy
Contributor II
Contributor II
Author

Thank you for your reply but your code does not work for me.

However, i did managed to solve it below. Not the best but i did get what i wanted.

 

Count(If(Aggr(Avg({$<[Fruit Name]={"Coconut"}>}[Value]),[Date]) > 100,'Yes',Null()))