Cheat Sheets/Power BI/RANKX
DAX function

RANKXDAX function reference

Rank rows by an expression.

Syntax

dax
RANKX(<table>, <expression>, [<value>], [<order>], [<ties>])

Examples

dax
RANKX(ALL(Product), [Total Sales])
A rank
dax
RANKX(ALLSELECTED(Product), [Total Sales], , DESC)
Rank among visible products, respecting slicers

The ties argument controls whether tied values consume multiple rank numbers (SKIP, the default) or share the same rank without a gap (DENSE).

dax
RANKX(ALL(Product), [Total Sales], , ASC, DENSE)
Ascending, dense ranking with no gaps after ties

Common mistakes & gotchas

Related DAX functions

From Iterators & variables

Used in these tutorials

← Back to the Power BI (DAX) cheat sheet