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
i have 4 columns named customername, department, country and profit. i am trying to rank based on profit it is giving me unique ranks for the whole table . What i need help with is if i am filtering a department named finance it contains 20 rows i need the ranks to be created new for that department based on the profit not the ranks from the whole table for the filtered department alone i need the ranks to start from begining any suggestions for that.
can we use RANKX inside another RANKX?
- Thejeswar2 years agoSuper User
Hi Viswanathan123 ,
If you are using the ALL() function, the RANK will not be recalculated for the slicer selection. Instead use the below DAX using ALLSELECTED() DAX function
Rank = RANKX(ALLSELECTED('Table'), [TotalProfit],,DESC,Dense)Before applying filter on departmentAfter applying filter on departmentRegards,