
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 | |
Group | ID_Unique |
A | 1 |
A | 2 |
A+B | 3 |
B | 4 |
C+A | 5 |
The desired output will be in pivot table, structure as follows:
Desired Output | ||||||
Group | Count(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)) |
A | 2 | |||||
B | 1 | |||||
A+B | 1 | |||||
C+A | 1 |
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
