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
Anonymous
Not applicable

Simple RANKX instructions - how to get rank value on a matrix with slicers?

Hello,

 

I want to achieve something seemingly simple, alas I'm failing miserably!

 

I have a table that contains unpivoted KPI metrics (e.g. awareness, quality, intention, etc)

 

I have created a report page with the following slicers:

- Date range

- Country

- Sector

- Metric

 

I have created a matrix that returns the average value based on the above filter selections, for example:

 

Brand                      Average of Score

Coke                                59.9

Pepsi                               58.6

Fanta                               46.1

Sprite                              43.0

 

What I want to achieve, is a table that contains the ranking value instead of the average score, so:

 

Brand                           Rank

Coke                                1

Pepsi                               2

Fanta                               3

Sprite                              4

 

Although this seems extremely easy, I have spent a good hour looking for a solution, but haven't managed to make it work. What confuses me is whether to use ALL, ALLEXCEPT, etc. and how as the Rank measure has to abide by all slicer selections for it to work.

 

Any help is much appreciated!

 

George

1 ACCEPTED SOLUTION

It is not possible to give you an accurate answer without knowing all the tables, columns and relationships.

Assuming there are none... and you have a measure called Average of Score

 

myRank = rankx(all(tableName[brand]),[Average of Score])



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

2 REPLIES 2

It is not possible to give you an accurate answer without knowing all the tables, columns and relationships.

Assuming there are none... and you have a measure called Average of Score

 

myRank = rankx(all(tableName[brand]),[Average of Score])



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Thank you very much Matt! Beautiful in its simplicity.

 

I had not thought of creating a Measure for the score (was using column average in my tab), which made the difference.

 

Thanks again,

 

George.

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.