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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Rank by Average Score in Date Range for Individual in Group

Hello,

I want to create a measure to get a dynamic individual rank by group based on date range selected.  The data table rows include: Date, Name, Group, and Score (among other things). I have slicers on the visual that allow for single selecting a Name, and one for selecting multiple dates. 

 

My goal is to be able to slice down to an individual and have a measure calculate the rank of the individual within their group based on an average of their scores as compared to an average of the scores for each of their peers in the same Group over the selected time period.

 

Example Table:

Date

Name

Group

Score

January

Bob

A

110%

January

John

A

85%

January

Carol

B

120%

February

Bob

A

60%

February

John

A

100%

February

Carol

B

110%

 

Carol should never be included in ranking against Bob and John because she is in a different Group.

 

If both Dates are selected,

          Bob’s average Score = (110+60)/2 = 85%

          John’s average Score = (85+100)/2 = 92.5%

          Carol’s average Score = (120+110)/2 = 115%

John should be ranked #1 and Bob should be ranked #2 for the sliced Dates.  Carol should be ranked #1 (based on her own group).

Now, if I slice down by Name to just see Bob’s information for that date range, his rank still needs to display as #2.

 

However, if the Date range is changed, and only January is selected,

          Bob’s average Score = 110/1 = 110%

          John’s average Score = 85/1 = 85%

Bob should now be ranked as #1.

 

I’d appreciate any assistance you could offer here.  I've tried several things and had no luck.  Thanks in advance!

1 REPLY 1
parry2k
Super User
Super User

@Anonymous these measure will do it:

 

Avg = AVERAGE( Table1[Score] )

Rank = RANKX( FILTER( ALL( Table1[Group], Table1[Name] ), Table1[Group] = MAX(Table1[Group] ) ), [Avg] , , DESC )

Add a table visual, put Group, Name, Avg and Rank on columns and you will get the result as expected.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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