Forum Discussion
Issue with RANKX function with "Don't Summarize" option
- 4 years ago
Hi, Anonymous
Create a measure 'Rank' as below, then sort by column rank:
Rank = RANKX ( GROUPBY ( ALLSELECTED ( 'TestData' ), TestData[Category], TestData[Date] ), RANKX ( ALLSELECTED ( TestData ), CALCULATE ( MAX ( TestData[Category] ) ), , ASC, DENSE ) + RANKX ( GROUPBY ( ALLSELECTED ( 'TestData' ), TestData[Category], TestData[Date] ), CALCULATE ( MAX ( 'TestData'[Date] ) ), , ASC, DENSE ) / CALCULATE ( COUNTROWS ( 'TestData' ), ALLSELECTED () ), , ASC, DENSE )Please check my sample file for more details. If it doesn't work, share a pbix file on cloud storage for further research.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak - Amit can you help me to sort the data within the group as well?
Hi, Anonymous
You need to sort column 'Category' first, then hold down 'Shift' and click another column (column'Date'/column'Rank') for secondary sorting.
Best Regards,
Community Support Team _ Eason
- Anonymous4 years agoNot applicable
v-easonf-msft - Can we do this using measure? Though your solution works for me but this is a sort of manual step.
- v-easonf-msft4 years agoCommunity Support
Hi, Anonymous
Create a measure 'Rank' as below, then sort by column rank:
Rank = RANKX ( GROUPBY ( ALLSELECTED ( 'TestData' ), TestData[Category], TestData[Date] ), RANKX ( ALLSELECTED ( TestData ), CALCULATE ( MAX ( TestData[Category] ) ), , ASC, DENSE ) + RANKX ( GROUPBY ( ALLSELECTED ( 'TestData' ), TestData[Category], TestData[Date] ), CALCULATE ( MAX ( 'TestData'[Date] ) ), , ASC, DENSE ) / CALCULATE ( COUNTROWS ( 'TestData' ), ALLSELECTED () ), , ASC, DENSE )Please check my sample file for more details. If it doesn't work, share a pbix file on cloud storage for further research.
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.