- Microsoft Power BI Cookbook
- Brett Powell
- 131字
- 2025-04-04 18:18:12
DAX Ranking Sort
- Create a Sort By Column sort based on a measure.
- In some scenarios, values from the RANKX() DAX function can provide a custom sorting column
- Per the sorting requirements, a unique rank value is required for each value sorted
- Create the DAX calculated column with the RANK(X) function:
- In some scenarios, values from the RANKX() DAX function can provide a custom sorting column

RankX () Calculated Column
- Sort the Department Group column by the new ranking column and hide the ranking column
The calculated column is re-evaluated during each refresh and thus sort order could change to reflect the source data.

Sort By Rank Effect
- The Department Group column now defaults to the order of the rank column with Sales and Marketing first
- In the report visual, revising the order displays the values in descending order with quality assurance first