How does the RANKX function (DAX) work?
The RANKX function (DAX) returns the ranking of a number in a list of numbers for each row in the table argument.
RANKX Formula Syntax
<table>, <expression>, <value>, <order>, <ties>
How do you use the RANKX function?
The RANKX function can be used in calculations for calculated columns as well as calculated measures. The RANKX function will still do what it is asked.
Related Blog Posts
Related Support Forum Posts
Considerations when using the RANKX function
- If expression or value evaluates to BLANK it is treated as a 0 (zero) for all expressions that result in a number, or as an empty text for all text expressions.
- If value is not among all possible values of expression then RANKX temporarily adds value to the values from expression and re-evaluates RANKX to determine the proper rank of value.
- Optional arguments might be skipped by placing an empty comma (,) in the argument list, i.e. RANKX(Inventory, [InventoryCost],,,”Dense”)
Related Video Tutorials
Formula examples using the RANKX function
=RANKX(ALL(Products), SUMX(RELATEDTABLE(InternetSales), [SalesAmount]))
= IF ( HASONEVALUE ( Test[Name] ), RANKX ( ALL ( Test[Name] ), [Sum Value] ) )
= RANKX( ‘Table’, ‘Table'[My Value] + (INT(‘Table'[Date]) / 100000) )