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.

Syntax

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

A table expression.

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: Dec 1, 2018   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

MSDN documentation: https://msdn.microsoft.com/en-us/query-bi/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.

Iterator

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.

Deprecated

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

Deprecated

This parameter is deprecated and its use is not recommended.

Contribute

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.