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
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
The rank number of Value among all possible values of Expression evaluated for all rows of Table numbers.
Remarks
The default value for the Order argument is DESC.
The default value for the Ties argument is SKIP.
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
-
Handling customers with the same name in Power BI
This article explains how to show different customers with the same name in a Power BI report by using zero-width spaces, thus simplifying the presentation without adding visible characters to make the names unique. » Read more
-
Sorting duplicated names in a level of a hierarchy with DAX
This article describes how to use DAX calculated columns to sort names that look like duplicates at a certain level of a hierarchy, but are unique when considering their full path within the hierarchy. » Read more
-
How to compute index numbers at top speed
This article presents different techniques to compute a rownumber column in DAX based on a specific ranking, comparing slow and optimized approaches. » Read more
-
Displaying Nth Element in DAX
This article describes how to create a measure displaying the name or value of an element that has a specific ranking, with different option for managing ties. » Read more
Related functions
Other related functions are:
Last update: Jan 11, 2021 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Kenneth Barber
MSDN documentation: https://docs.microsoft.com/en-us/dax/rankx-function-dax