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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Reverse Ranking DAX or Measure

Hi Everyone!

 

I am trying to reverse rank in PowerBI Desktop (this will eventually get published online, if that matters).

 

The following is a sample data table which is very similar to what I am working with. I am only showing relevant columns here.

 

DateNameTime for action

Data Set
DateNameTime (s)
1/1/2022John Doe5
1/1/2022John Doe5
1/1/2022Jane Doe4
1/1/2022John Doe7
1/1/2022Jane Doe6
1/1/2022Mark Marlo8
1/1/2022Mark Marlo10
1/1/2022John Doe10

 

I would like to rank the people in the following manner:

 

DateNameTime for actionRank

Ranked Table
DateNameTotal Time (s)Rank
1/1/2022John Doe273
1/1/2022Jane Doe101
1/1/2022Mark Marlo182

 

This is a sample table. My actual data goes back 30 days. As you can see from the data table, there are multiple records for the same person.

 

I have watched a lot of YouTube videos for ranking top 10 products or bottom 10 products and tried to adapt it to my use case. Being a very new PowerBI user, I am at my wit's end on how to approach this.

 

If it matters, I am also filtering the data by "Today", "1 Week", "2 Weeks", "1 Month".

 

Appreciate any and all help!

 

Thank you!

1 ACCEPTED SOLUTION

Is the Operator column shown the same one you put in the ALLSELECTED? Is that column sorted by another column? Do you have multiple tables in your model? If so, what are the relationships between them?

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@mahoneypat Thank you! That was the missing piece!

mahoneypat
Microsoft Employee
Microsoft Employee

Please try this measure expression in a table visual without your Date column (you mentioned using date filters over a bigger date range). Just replace T1 with your actual table name.

 

ReverseRank =
RANKXALLSELECTED( T1[Name] ), CALCULATESUM( T1[Time (s)] ),, ASC )

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hi @mahoneypat !

 

Thank you so much for your quick response!

 

Your DAX did get me some results. I am seeing that the ranking does not change with selection.

 

I guess, I need to provide more context. My bad.

 

During any shift, I can have anywhere between 9-12 operators working. So, based on the timeframe, I would see multiple instances of the same operator. The time field is capturing the time it takes them to complete an action. For example, in one shift I may have 10 operators working. They are performing the same action repeatedly - which is picking an item, scanning it, and placing it in a bin. They maybe picking around 5,000 items. So during one shift, I may have around 50,000 datapoints of time. What I want to achieve is that depending on the timeframe selected, I want to rank the performance of each operator from 1 to total number of operators working during that timeframe.

 

The result I am seeing ranks each action by an operator, I guess. I see the rankings in 32,000 range. I am not able to see the ranks from 1 to N. Please see the screenshot below:

 

2022-02-24 20_26_08-Window.jpg2022-02-24 20_26_22-Window.jpg

 

If I add "Dense" at the end of your measure, the rankings change to 700 series. 

 

Can you please advise?

 

Thank you!

Is the Operator column shown the same one you put in the ALLSELECTED? Is that column sorted by another column? Do you have multiple tables in your model? If so, what are the relationships between them?

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.