OpenBI Docs Buy

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>] )
ParameterTypeDescription
valueValueThe value to rank: usually the same column, in a row of its table.
columnNameColumnA column of the model whose values, in the current filters, the value is ranked among.
orderNumber
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 ALL of a column, use RANKX.

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]
PlaceCratesRank
Shop Grünerløkka181
Shop Bjørvika162
Shop St. Hanshaugen153
Shop Majorstuen144
Shop Torshov144
Shop Sagene136
Shop Frogner127
Shop Grønland127
Shop Tøyen119
Shop Nydalen1010
Shop Vålerenga1010
Shop Kampen912
Shop Storo912
Shop Skøyen814
Shop Ullevål715
Depot Alnabru016

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 firstSmallest firstNot a price
23(blank)

RANKX, RANK, TOPN, PERCENTILE.INC.

Last updated · OpenBI Studio 0.3.74