Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
stascher
Partner - Creator II
Partner - Creator II

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)
  • Chart

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 II
Partner - Creator II
Author

Knew I could count on you Sunny. Thanks much!