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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stascher
Partner - Creator III
Partner - Creator III

Counting dimension value when equal to max of another dimension.

Given the following table:

SubjectEventSeverity
Bobfall1
Bobfall2
Bobfall1
Janfall3
Jancut2
Janbreak3
Janbreak2
Stewcut1
Stewcut1
Stew break 3

I want to create a stacked bar chart where Event is one dimension, Severity is another

and the measure is a distinct count of Subjects experiencing each Event for a given Severity,

but ONLY if the Severity is the maximum severity that Subject ever experienced for the given Event.

I tried count( distinct aggr( if( max( Severity)=Severity, Subject),Subject))    but obviously it didn't work.

Thanks for any help,

Steve

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

This is what I get

Capture.PNG

View solution in original post

3 Replies
sunny_talwar

How about this

Count(DISTINCT Aggr(If(Max(TOTAL <Event, Subject> Severity) = Severity, Subject), Subject, Event, Severity))

sunny_talwar

This is what I get

Capture.PNG

stascher
Partner - Creator III
Partner - Creator III
Author

Knew I could count on you Sunny. Thanks much!