Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wayersGM
Frequent Visitor

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!!

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@wayersGM , Try new Rank

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

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Untitled.png

 

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

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
wayersGM
Frequent Visitor

@Jihwan_Kim , @amitchandak ,

Thanks for the help! Both solutions work as expected.

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Untitled.png

 

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

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@wayersGM , Try new Rank

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.