Forum Discussion

wayersGM's avatar
wayersGM
Frequent Visitor
4 years ago
Solved

Using RANKX with multiple columns to evaluate

Hello Community, 

 

I am trying to create a calculated column to deliver a rank. I have a table of data the looks something like this...

 

Test IDRun ID

1

5
18
13
26
23
21
31
35
39

 

And Im looking to rank the Run ID from highest value to lowest for each Test ID, the expected table would show...

 

Test IDRun IDRank

1

52
183
131
263
232
211
311
352
393

 

Any help from the community is much apperciated!!

  • Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a new column.

     

     

    Rank CC =
    VAR currentTestID = Data[Test ID]
    VAR withinTestID_Table =
        FILTER ( Data, Data[Test ID] = currentTestID )
    RETURN
        RANKX ( withinTestID_Table, Data[Run ID],, ASC )
    

3 Replies

Replies have been turned off for this discussion
  • wayersGM , Try new Rank

    Rank = rankx(filter(Table, [Test ID] = earlier([Test ID]) ), [Run ID] )

  • Hi,

    Please check the below picture and the attached pbix file.

    It is for creating a new column.

     

     

    Rank CC =
    VAR currentTestID = Data[Test ID]
    VAR withinTestID_Table =
        FILTER ( Data, Data[Test ID] = currentTestID )
    RETURN
        RANKX ( withinTestID_Table, Data[Run ID],, ASC )