Forum Discussion
RANX returns same ranking for two different values
- Anonymous4 years ago
Hi Anonymous ,
If you are creating a measure for Rank, please use this -
Rank Measure = RANKX(ALL('Table'[Customer]),CALCULATE(SUM('Table'[Sales])),,DESC)Else, if you want to create a column, first need to create another column for total sales.Total Sales = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=EARLIER('Table'[Customer])))Rank Column = RANKX('Table','Table'[Total Sales],,desc) - 4 years ago
Anonymous ,
Yes !! If you want to avoid using Calculate, you may try to use a separate measure, where you get the sales values. Then use it inside the RANKX function.
The Below post might give you more info on this
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
Hi Anonymous ,
You need to modify your RANKX as follows
RankMeasure = RANKX(ALL('Table'[Customer]), CALCULATE(SUM('Table'[Sales])),,DESC)
. Here RANKX is written inside a calculated Measure
If you don't want to see the Rank in Total row, use the below DAX
RankMeasure = IF(HASONEFILTER('Table'[Customer]), RANKX(ALL('Table'[Customer]), CALCULATE(SUM('Table'[Sales])),,DESC))
- Anonymous4 years agoNot applicable
Thejeswar - This worked. One last thing. Is CALCULATE mandatory here? and why?
- Thejeswar4 years agoSuper User
Anonymous ,
Yes !! If you want to avoid using Calculate, you may try to use a separate measure, where you get the sales values. Then use it inside the RANKX function.
The Below post might give you more info on this
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures