DAX Function Guide

RANKX
Empty image or helper icon

Sam McKay

CEO & Founder

How does the RANKX 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

RANKX(
     <table>, <expression>, <value>, <order>, <ties>
)

How do you use the RANKX?

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

Loading

Considerations when using the RANKX?
  • 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

Loading

Formula examples using the RANKX

=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) )

Related Courses

Loading