Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Imagauthamam
Helper III
Helper III

RANK and RANKX DAX function

Hi All,

 

I'm currently learning RANK and RANKX Dax functions.
Can someone explain the difference between these 2 functions and on what scenarios you use each of these DAX functions.
Is there something which is possible in one but not possible in the other and which you do you use most and why?

 

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Imagauthamam 

RANK function makes ranking on multiple columns much simpler as it allows sorting by multiple columns as a native feature. Doing this with RANKX will require some DAX acrobatics. This blog from SQLBI explains the difference quite well and also provides some examples - https://www.sqlbi.com/articles/introducing-the-rank-window-function-in-dax/ 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
v-ssriganesh
Community Support
Community Support

Hi @Imagauthamam,

Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to @Deku@andrewsommer & @danextian for sharing valuable insights.

 

Could you please confirm if your query has been resolved by the provided solution? If so, please mark it as the solution. This will help other community members solve similar problems faster.

Thank you.

Thanks @v-ssriganesh. I have marked the right answer. Thanks for the reminder

Deku
Super User
Super User

RANKX came out first.

 

RANK was introducted with all other window functions to support visual calculations


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
andrewsommer
Super User
Super User

I think this is one a lot of people struggle with.  There is a significant difference between these two unlike SUM and SUMX that are somewhat similar.

 

RANKX: calculates the rank of a value among all possible values derived from the evaluation of an expression across all rows in a table. It provides a rank number based on evaluating the expression for each row, with the default sort order being descending.

 

RANK: In contrast, RANK returns the ranking for the current context within a specified partition, sorted by the specified order. If no match is found, the rank is returned as blank. The default sort order for RANK is ascending.

When used in a measure, RANKX cannot use a column to define the rank order in the expression, while RANK can.

RANK is preferred over RANKX when it comes to handling ties and sorting blanks.

We almost always use RANK and rarely ever use RANKX

danextian
Super User
Super User

Hi @Imagauthamam 

RANK function makes ranking on multiple columns much simpler as it allows sorting by multiple columns as a native feature. Doing this with RANKX will require some DAX acrobatics. This blog from SQLBI explains the difference quite well and also provides some examples - https://www.sqlbi.com/articles/introducing-the-rank-window-function-in-dax/ 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.