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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

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] )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.


Click here to visit 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.


Click here to visit my LinkedIn page

amitchandak
Super User
Super User

@wayersGM , Try new Rank

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.