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

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

Reply
Anonymous
Not applicable

RANKX within groups without creating multiple tables

Hi all, 

 

I'm struggeling to make a RANKX measure in which I rank sales value of different brands. 

 

In the fictional table below I want to rank Brand by Category ignoring the columns subcategory and subbrand. I tried things like allselected, values, all, summarize columns but nothing gives the right answer. I do not want to use seperate tables per category because the report needs all categories within the same slicer and I need the columns that are ignored. 

 

Any ideas are much appreciated. 

 

CategorySubcategoryBrand SubbrandSales ValueDesired RANKX outcome
FacecareCleansingAngelo Joanna                       7.1001
FacecareCleansingLucie Mandy                       7.4004
FacecareCleansingMarco Hannah                       6.8005
FacecareCleansingMaximilian Udo                       8.5002
FacecareCleansingRoberto Elmar                          8007
FacecareMoisturizingAngelo Heinz-Peter                       9.3001
FacecareMoisturizingLucie Hans-Walter                       1.0004
FacecareMoisturizingMaren Dietrich                       9.1003
FacecareMoisturizingMaximilian Christina                       4.3002
FacecareMoisturizingOtmar Ekkehard                       6.6006
SuncareAftersunAndré Anita                       5.5005
SuncareAftersunMaximilian Michaela                       2.8002
SuncareAftersunKornelia Heiderose                       5.1006
SuncareAftersunNicolas Annegret                          4001
SuncareSPFDorothee Dora                       5.9003
SuncareSPFGabriel Lieselotte                       5.6004
SuncareSPFMaximilian Carola                       3.9002
SuncareSPFMaik Sabine                       1.1008
SuncareSPFNicolas Aloisia                       8.3001
SuncareSPFRose Maja                          4009
SuncareSPFUlli Elsbeth                       2.6007

 

For extra bonus points 😉 : later I want to use the rank outcome to create a measure giving the brand name of the top 5 ranked brands and all other brands to be called "other" which have to go in the rows of a matrix table visual. This might be important for any answer. 

 

Thanks once again!

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous there are amazing posts on this, take a look here

 

Showing the top 5 products and Other row - SQLBI

 

Filtering the Top 3 products for each category in Power BI - SQLBI

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@Anonymous there are amazing posts on this, take a look here

 

Showing the top 5 products and Other row - SQLBI

 

Filtering the Top 3 products for each category in Power BI - SQLBI

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

Anonymous
Not applicable

@parry2k thanks so much for your help! I've used the first article that you've posted but I'm stuck again.

 

Referring to an example of the article itself;

 

breuwer_0-1630933332779.png

 

I would like to do a calculation where the share of sales value ranking name (or product name) is divided by total sales value of all filtered subcategories. However, when I create a calculated table to include the subcategory the top N is calculated incorrectly since the ranking name is not unique anymore. Do you have any pointers how to go about on this? 

 

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Kudoed Authors