Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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.

       

       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]))

       

       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