RANK.EQ
A value's rank among a column's values: 1 the largest, or the smallest with order 1; text ranks too.
Group: Statistics. Compatible with DAX.
Syntax
RANK.EQ ( <value>, <columnName> [, <order>] )
| Parameter | Type | Description |
|---|---|---|
value | Value | The value to rank: usually the same column, in a row of its table. |
columnName | Column | A column of the model whose values, in the current filters, the value is ranked among. |
order | Number optional | 0 or FALSE, the default, to rank the largest first; 1 or TRUE for the smallest first. |
Returns
Whole number. The value's place among the column's values: 1 for the first.
Remarks
- Tied values share the better rank and the next rank is skipped: two places tied fourth are followed by the sixth.
- When the value is not one of the column's values, or is blank, the result is BLANK.
- Text ranks too, by alphabet: with order 0 the last name alphabetically comes first.
- Any order other than 0 or 1 is an error.
- To rank by a measure, or against
ALLof a column, useRANKX.
Examples
Places ranked by crates
EVALUATE
SELECTCOLUMNS (
Places,
"Place", Places[Place],
"Crates", Places[Crates],
"Rank", RANK.EQ ( Places[Crates], Places[Crates] )
)
ORDER BY [Rank], [Place]
| Place | Crates | Rank |
|---|---|---|
| Shop Grünerløkka | 18 | 1 |
| Shop Bjørvika | 16 | 2 |
| Shop St. Hanshaugen | 15 | 3 |
| Shop Majorstuen | 14 | 4 |
| Shop Torshov | 14 | 4 |
| Shop Sagene | 13 | 6 |
| Shop Frogner | 12 | 7 |
| Shop Grønland | 12 | 7 |
| Shop Tøyen | 11 | 9 |
| Shop Nydalen | 10 | 10 |
| Shop Vålerenga | 10 | 10 |
| Shop Kampen | 9 | 12 |
| Shop Storo | 9 | 12 |
| Shop Skøyen | 8 | 14 |
| Shop Ullevål | 7 | 15 |
| Depot Alnabru | 0 | 16 |
A price's rank, both ways
Prices are 30, 38, 52 and 64: 52 is second from the top and third from the bottom. 50 is not a price, so it has no rank.
EVALUATE
ROW (
"Largest first", RANK.EQ ( 52, Products[Price per liter] ),
"Smallest first", RANK.EQ ( 52, Products[Price per liter], 1 ),
"Not a price", RANK.EQ ( 50, Products[Price per liter] )
)
| Largest first | Smallest first | Not a price |
|---|---|---|
| 2 | 3 | (blank) |
Related functions
RANKX, RANK, TOPN, PERCENTILE.INC.