Forum Discussion

left4pie2's avatar
left4pie2
Helper I
3 years ago
Solved

RANKX

I'm struggling to figure out how to properly use RankX.

 

Here is a test table I created with names and points.

I'd like to sum the total points for each name and then rank them.

 

I tried this with the measure 

Rank = RANKX(ALL(TestTable),SUM(TestTable[Points]))
But it just gives every name a rank of 1.
 
Where am I going wrong?

 

  • Hi,

     

    create a measure

     

     

     

    SumOfPoints = SUM(TestTable[Points])

     

     

     

    and change your rank

     

     

     

    Rank = RANKX(ALL(TestTable[Name]), [SumOfPoints])

     

     

     

    Please see RANKX – DAX Guide for more information, the part why i use an extra measure:

     

    The Expression argument is evaluated in a row context: while a measure reference implies a context transition, an explicit CALCULATE might be necessary using aggregation functions such as SUM.

1 Reply

  • lukiz84's avatar
    lukiz84
    Memorable Member

    Hi,

     

    create a measure

     

     

     

    SumOfPoints = SUM(TestTable[Points])

     

     

     

    and change your rank

     

     

     

    Rank = RANKX(ALL(TestTable[Name]), [SumOfPoints])

     

     

     

    Please see RANKX – DAX Guide for more information, the part why i use an extra measure:

     

    The Expression argument is evaluated in a row context: while a measure reference implies a context transition, an explicit CALCULATE might be necessary using aggregation functions such as SUM.