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
Anonymous
Not applicable

Need Help about RANKX when using in measure, it always return 1

Hi experts,

       I found an error when using RANKX as measure in my model, it always return 1.

       There are 2 tables in my model, one is calendar and another is transaction records with transaction date. In addition, I build relationship between calendar date and transaction date.

       20210308163436.jpg

       For rank of how much time has elapsed since a customer’s last transaction, I created several measures:

       Measure 1: Current Calendar Date

       Current Calendar Date = MAX('Calendar'[Date])

       Measure 2: Current Transaction Date 

       Current Transaction Date = IF(ISBLANK(MAX(data[Transaction Date])),MINX(ALLSELECTED(data),data[Transaction Date]),MAX(data[Transaction Date]))

       Measure 3:Days

       Days =SWITCH (TRUE (),LEN ( [Current Transaction Date] ) = 0, 0,VALUE ( [Current Calendar Date] - [Current Transaction Date] ))

       Measure 4:Days-Rank

       Days-Rank = RANKX(ALLSELECTED('Summarize-RFM'),CALCULATE([Days]))

       20210308163551.jpg

       File share link:https://1drv.ms/u/s!AqpJKo3pWwgIgYMdswp672vyC2ijKQ?e=q3ORrx

       I searched almost all Internet, but no one article could fix this issue, would you mind help me check the model?

       Hope your reply!

       Thanks

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Assuming all others are measure in the table, try like

 

Days-Rank = RANKX(ALLSELECTED('Summarize-RFM'[customer No]),[Days])

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Assuming all others are measure in the table, try like

 

Days-Rank = RANKX(ALLSELECTED('Summarize-RFM'[customer No]),[Days])

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

ohhh!It's all right!Thanks for your help.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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