RANKX DAX Function (Statistical)

Returns the rank of an expression evaluated in the current context in the list of values for the expression evaluated for each row in the specified table.


RANKX ( <Table>, <Expression> [, <Value>] [, <Order>] [, <Ties>] )
Parameter Attributes Description

A table expression.

Row Context

An expression that will be evaluated for row of the table.

Value Optional

An expression that will be evaluated in the current context. If omitted, the Expression argument will be used.

Order Optional

The order to be applied. 0/FALSE/DESC – descending; 1/TRUE/ASC – ascending.

Ties Optional

Function behavior in the event of ties. Skip – ranks that correspond to elements in ties will be skipped; Dense – all elements in a tie are counted as one.

Return values

Scalar A single integer value.

The rank number of Value among all possible values of Expression evaluated for all rows of Table numbers.

Related articles

Learn more about RANKX in the following articles:

  • Use of RANKX in Power BI measures

    The RANKX function in Power BI might have an unexpected behavior when applied to a column that has a specific sort order in the data model. This article explains why, and how to address this issue. » Read more

Related functions

Other related functions are:

Last update: Aug 3, 2019   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

MSDN documentation: https://docs.microsoft.com/en-us/dax/rankx-function-dax

DAX Conventions
Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.


Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.


This function is deprecated. Jump to the Alternatives section to see the function to use.


This parameter is deprecated and its use is not recommended.


Want to improve the content of RANKX? Did you find any issue? Please, report it us!
All submissions will be evaluated for possible updates of the content.