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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

count giving Nested aggregation error

Following one of Sunny’s solutions to https://community.qlik.com/message/1373145#1373145

Where I was trying to figure out how many students (and who are they) that are still having  a grade below 5 for  THE LAST 3 consecutive test date (not just 3 consecutive test date in the past)

And using one of the suggested solution:

=If(Max(TOTAL <Name> Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date])) < 5, Only(Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date])))

I am now also  trying to count how many students are there that are shown,

=count(distinct <the above>)

so using:

=count(distinct If(Max(TOTAL <Name> Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date])) < 5, Only(Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date]))))

03-11-2017 08-47-53.png

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be this

=Count(DISTINCT Aggr(If(Max(TOTAL <Name> Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date])) < 5, Name), Name, [Test Date]))

View solution in original post

5 Replies
Anonymous
Not applicable
Author

S1 and S3 I meant

jonathandienst
Partner - Champion III
Partner - Champion III

This is the correct expression I think:

=Count(DISTINCT Aggr(If(Max(TOTAL <Name> Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date])) < 5, Only(Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date]))), [Test Date], [Name]))

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

thanks, but giving 3 I would have expect 2 (S1 & S3)

sunny_talwar
MVP
MVP

May be this

=Count(DISTINCT Aggr(If(Max(TOTAL <Name> Aggr(If([Test Date] >= Max(TOTAL <Name> [Test Date], 3), Score), Name, [Test Date])) < 5, Name), Name, [Test Date]))

Anonymous
Not applicable
Author

Thank you, worked