Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
harisin22
New Contributor

Calculate median, IQR, and min/max from count by group

Hello:

I would like to calculate median, the IQR (25%, 75%), and min and max  of a count of values, by group. See example table below:

Input Table
GroupID_Unique
A1
A2
A+B3
B4
C+A5

 

The desired output will be in pivot table, structure as follows:

Desired Output     
GroupCount(ID_Unique)Median(Count(ID_Unique))Fractile(Count(ID_Unique), 0.25)Fractile(Count(ID_Unique), 0.75)Mix(Count(ID_Unique))Max(Count(ID_Unique))
A2     
B1     
A+B1     
C+A1     

 

I have spent a lot of time trying to figure how to calculate median/fractile (IQR) values from a count - I can't seem to figure this out.

Any help would be greatly appreciated.

Thank you,

Sin

1 Reply
Highlighted
MVP & Luminary
MVP & Luminary

Re: Calculate median, IQR, and min/max from count by group

Hi,

what you are trying to do is called "nested aggregation" - you are trying to apply one aggregated function on top of another. In Qlik Sense, you have to use the AGGR() function or the TOTAL qualifier in order to nest aggregation functions. For example:

median(

     AGGR(

          count(ID), Group)

)

I'm teaching a whole 3-hours lecture on the rules and analytical uses of the AGGR() function at the Masters Summit for Qlik - check out our agenda and see if our advanced training is for you. We will be in Washington, DC and in Amsterdam, Netherlands this fall.

Cheers,

Oleg Troyansky