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

Announcements
Week 2: Presenting "Automate Sucess" and "Integration for Innovation" - WATCH NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Bolderaft
Contributor
Contributor

honoring the dimension within nested aggregation

Been beating my head against the wall. What am I missing?

Trying to create a measure to count active records below the median:

=Count (if (InCareNow=1 and SpellDays<Median(Total SpellDays), SpellID))

The problem is that the nested aggregation is scoped over all records, but I want the median just for the group of records associated with the dimensional value. I want to remove the "Total" qualifier from the inner aggregation but this is not allowed. My tiny brain does not comprehend why.

I have tried using Aggr but ran into the same issue. Any help would be appreciated. Thank you!

Labels (1)
2 Replies
Chanty4u
MVP
MVP

Try this 

Count(

  If(

    InCareNow = 1 and SpellDays < 

    Aggr(Median(SpellDays), [Patient Group]),

    SpellID

 

  )

)

Bolderaft
Contributor
Contributor
Author

Thanks, I tried this as well but this is not working. Not sure why!