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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
kaylastarr
Advocate V
Advocate V

Help using RankX as a measure

Hello All,

 

I am struggling to create a measure to display the rank in a table. I have a table with the following columns

Promo Name, Start Date, Region, Total Quoted Sales. I am trying to display the rank by Promo Name and Start date based on the sum of total sales.

 

My current measure is:

RankM = RANKX(ALLselected('Promo Summary Table'),CALCULATE(sum('Promo Summary Table'[Total Quoted Sales]), ALLEXCEPT('Promo Summary Table','Promo Summary Table'[Promo Name)),,DESC,Dense)

This is close to correct but instead of calculating for each PromoName - Start Date pair it calculates for each promo name 
kaylastarr_0-1718721421370.png

If I create a column key unique for each Promo Name and Start date then each rank is just one. Any help would be appreciated



1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @kaylastarr 

I create a table:

vyohuamsft_1-1718762253817.png

 

You can use the following DAX expression:

Rank Test =
ROWNUMBER (
    ALLSELECTED ( 'Table'[Promo Name], 'Table'[Start Date] ),
    ORDERBY ( 'Table'[Promo Name], DESC, 'Table'[Start Date], ASC )
)

 

Here is my preview:

vyohuamsft_0-1718762236640.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @kaylastarr 

I create a table:

vyohuamsft_1-1718762253817.png

 

You can use the following DAX expression:

Rank Test =
ROWNUMBER (
    ALLSELECTED ( 'Table'[Promo Name], 'Table'[Start Date] ),
    ORDERBY ( 'Table'[Promo Name], DESC, 'Table'[Start Date], ASC )
)

 

Here is my preview:

vyohuamsft_0-1718762236640.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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