Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

need help with Ranking in DAX

Below is my data

 

PersonPriceCallsMeasure - Price/Calls
Tom6319.8510261.95931373
Harry3345.95956.71016949
Gina7678.5513756.04781022
George10882.3520852.31899038
Arnold9239.5519746.90126904
Frank8605.618446.76956522
Peter9338.820645.33398058

 

 Below is my code for ranking

 

RANKX (ALLSELECTED(Table ), CALCULATE(SUMX(Table,Table[Measure - Price/Calls])))
 
and I keep getting everything as Rank 1.
 
PersonPriceCallsMeasure - Price/CallsRank
Tom6319.8510261.959313731
Harry3345.95956.71016949

1

Gina7678.5513756.047810221
George10882.3520852.318990381
Arnold9239.5519746.901269041
Frank8605.618446.769565221
Peter9338.820645.333980581
 
 
Below is what I am looking for 
 
PersonPriceCallsMeasure - Price/CallsRank
Tom6319.8510261.959313731
Harry3345.95956.710169492
Gina7678.5513756.047810223
George10882.3520852.318990384
Arnold9239.5519746.901269045
Frank8605.618446.769565226
Peter9338.820645.333980587
 
Please help.
  • Anonymous's avatar
    Anonymous
    7 years ago

    Oh, I thought it was just a table and each person had one piece of data.

    You may try the followings:

    RANKX( ALLSELECTED( Table), 
           CALCULATE( [Price divided by Calls], ALLEXCEPT( Table, Table[Person])),
           ,
    DESC,
    Dense)

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    May I know why you use SUMX in your expression? I think it can be as simple as below:

    RANKX( Table, Table[Measure - Price/Calls])

    • Anonymous's avatar
      Anonymous
      Not applicable

       

      Below is a snapshot of the data that i am working with and with your code for Rank i get below.

       

       

       

       

      Not sure what am i missing here. 

      • Anonymous's avatar
        Anonymous
        Not applicable

        Oh, I thought it was just a table and each person had one piece of data.

        You may try the followings:

        RANKX( ALLSELECTED( Table), 
               CALCULATE( [Price divided by Calls], ALLEXCEPT( Table, Table[Person])),
               ,
        DESC,
        Dense)