Rank Function
The Rank function calculates the rank for each value in a set of input values.
The Rank Group function calculates the same rankings but groups them only by the specified alignment hierarchy arguments, and is recommended when your metric set contains multiple hierarchies.
1. Syntax
Rank:
RANK(d0,s0,s1,s2,Alignment)
Rank Group:
RANKGROUP(d0,s0,s1,s2,Alignment)
2. Input
The Rank functions require the following input:
- d0 - The set of data values for which the rank is calculated.
3. Parameters
The Rank functions accept the following parameters.
- s0 - Indicates which way the values should be sorted for ranking. 0 for descending, 1 for ascending. The default value is 0.
- s1 - Indicates how ties should be handled. The default value is 0.
0 - Order of occurrence breaks tie
1 - Podium
2 - Lowest possible
3 - Highest possible
- s2 - If greater than 0, ranks will be scaled so that the highest rank is the value. The default value is 0.
- Alignment (optional) - Hierarchy placeholder to be used as the alignment axis if there are multiple hierarchies present in the metric set. Using RANKGROUP is recommended:
- For RANK, specify the hierarchy whose values should be ranked. These rankings may be grouped by other hierarchies present in the metric set.
- For RANKGROUP, specify the hierarchies by which the rankings should be grouped, or leave out this argument to rank all measure values together without any grouping.
4. Output
The Rank functions generate the following output:
- Rank - The Rank result set, consisting of rank values corresponding with each input value.