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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RichXM655
Helper I
Helper I

Ranking a value based on a combination of values

Hi. I have a bunch of satisfaction data. it covers various Sites and Category, and what I need to do is calculated a ranking value for each Site, based on how its score compares to other Sites in the same Category.

Example Data below - "Site Category Rank" is what I'm trying to calculate.

SiteCategoryScoreSite Category Rank
New YorkCustomer Service751
LondonCustomer Service652
ParisCustomer Service593
MunichCustomer Service154
New YorkHR653
LondonHR524
ParisHR851
MunichHR752


I have a rough ideas of what I need to do - for each cell generate a table of all the sites with their scores, filtered to just the category of the row, get the rank position of the site on that table, but the actual implmentation is eluding me.

This is basically (I think) the same as is described in this post from 2019 : https://community.powerbi.com/t5/Desktop/DAX-Ranking-data-based-on-multiple-categories/m-p/672427#M3... 
but "porting" that DAX over to my file doesn;t seem to work - there's clearly something important I'm missing.

3 REPLIES 3
RichXM655
Helper I
Helper I

I do have a column that's unique for each row, It's a concatenation of the site and category so every row's value is unique, though it won;t let me set that column as the key value for the table.

Don't know why it wouldn't if the values are unique, but you can just use Power Query to add an index column.

johnt75
Super User
Super User

You need a column which can uniquely identify each row. If you don't have one already you can use Power Query to add an index column. In the modelling view, mark that column as the key column for the table, and then you can use

Site Cat Rank Measure = 
RANK( SKIP, ALL( 'Table' ), ORDERBY( 'Table'[Score] , DESC), PARTITIONBY( 'Table'[Category]))

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.