Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

RANX returns same ranking for two different values

This is my table  Customer      Sales A 6 B 13 D 5 E 7 R 8 G 2 A 9   This is what I get from the DAX below : =RANKX(ALL(Sheet1),Sheet1[Totalsales]) where [Tota...
  • Anonymous's avatar
    Anonymous
    4 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)