DAX Language - RANKX Function

A-Badde | Posted on May 05, 20

RANKX Function


The RANKX function returns the rank of an expression in the list of values for each row in the table argument.

 Return Value:

RANKX returns a single integer value, representing the rank number of values among all possible values of expression.


RANKX( <table>,<expression>[,<value>[,<order>[,<ties>]]] )
  • Description of the parameters:




DAX expression that returns a table 


The expression is evaluated for each row of table


DAX expression that returns a single scalar value whose rank is to be found. Optional


Value that specifies how to rank value. Optional
0, FALSE or DESC: Rank in descending order
1, TRUE or ASC: Rank in ascending order


An enumeration that defines how to determine ranking when there are ties. Optional



In this example, we want to add a measure that calculates the sales amount ranking for each product subcategory in the Product SubCategory table.

The following formula shows how to add a rank measure, that displays the rank of each Product Sub Category by Sales amount in descending order

Rank = RANKX(

 Note that:

  • When the value parameter is omitted, the value of expression at the current row is used instead.
  • Optional arguments might be skipped by placing an empty comma (,) in the argument list.
  • The default value for the Order argument is DESC.
  • The default value for the Ties argument is SKIP.


Related Video:



(0) Comments

There is no comment

Leave a Comment
Add to favorite
Recent Posts
DAX Language - CONTAINS Function
A-Badde | May 09, 20

The CONTAINS function returns a boolean value, TRUE if each ...Read More

DAX Language - RANKX Function
A-Badde | May 05, 20

The RANKX function returns a single integer value that repre...Read More

DAX Language - AND and OR Functions
A-Badde | April 10, 20

AND/OR functions check whether all arguments are TRUE or one...Read More

DAX Language - Variables in DAX
A-Badde | April 10, 20

Use Var keyword to store the result of an expression as a na...Read More