GROUPTOPN
SyntaxÂ
Description
Selects the top N values from a group. If this function is applied on a date column, top N means the N most recent dates.
This is a group series function.
Example
Given the following data:
Groups | Participants |
---|---|
group1 | 6 |
group1 | 12 |
group1 | 5 |
group1 | 5 |
group1 | 5 |
group1 | 7 |
group1 | 5 |
group1 | 9 |
group1 | 8 |
group2 | 24 |
group2 | 24 |
group2 | 24 |
group2 | 33 |
group2 | 33 |
group2 | 29 |
group2 | 30 |
group2 | 32 |
group2 | 35 |
First create a group using GROUPBY(#RawData!Groups)
Groups |
---|
group1 |
group2 |
Then use the GROUPTOPN(#RawData!Participants;3). The result is the top "N" (in this case "3") values of the column in relation to the GROUPBY() column.
Groups | Participants_TOP3 |
---|---|
group1 | 12 |
group1 | 9 |
group1 | 8 |
group2 | 35 |
group2 | 33 |
group2 | 33 |