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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.