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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
kerkying
Partner Ambassador Affiliate
Partner Ambassador Affiliate

Max dimension across an associated dimension

Hi all, 

I have a requirement to only show the max student ID out of any given Class, as well as calculate related measures for that student only. 

I have tried set analysis on the measures to control the records shown on the table but it is only evaluating correctly when I am filtering on a particular Class. 

SUM({<[Student ID] = {'$(=aggr(max([Student ID]),[Class])'}>}[Score]

Also tried:

SUM({<[Student ID] = {'$(=rangemax(aggr(max([Student ID]),[Class]))'}>}[Score]

in both cases when i filter on a particular Class, i am able to get expected results but when i unfilter, the expression doesnt works. Any suggestions to evaluate across the whole dataset?

 

Dataset:

ClassStudent IDScore
Class A2020001 
Class A2020002 
Class A2020003 
Class A2020004 
Class A2020005 
Class B2020006 
Class B2020007 
Class B2020008 
Class B

2020009

 

 

Expected table output:

ClassMax Student IDScore
Class A2020005 
Class B2020009 
Labels (2)
3 Replies
Kushal_Chawda
MVP
MVP

@kerkying  set analysis won't work here as set analysis works once per chart and not row by row so try below

=if([Student ID]= max(total <Class>[Student ID]),sum(Score),0)
kerkying
Partner Ambassador Affiliate
Partner Ambassador Affiliate
Author

Thanks for the reply, is there anyway i can hide the record if the expression returns 0?

kerkying
Partner Ambassador Affiliate
Partner Ambassador Affiliate
Author

Hi all, I've found a way:

SUM({<[Student ID] = {$(=concat(Aggr(distinct max([Student ID]),[Class]),','))}>}[Score]

Not sure why removing the single quotation around the evaluation will resolve the issue though.