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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
TCavins
Helper V
Helper V

MATRIX Ordinal Rank / Top N by category/subcategory

I'm trying to get the ordinal rank for the following matrix. How would I go about displaying just the Top N results per month in the following Matrix?For example, how do I get only the first 20 records per Month regardless of ties in the Product column?

 

I've played around with Ranking by products but this gives me more than the Top N as there are duplicates. I've tried determining the number of duplicates but that measure is returning the incorrect value.

 

Capture.JPG

1 ACCEPTED SOLUTION

4 REPLIES 4
amitchandak
Super User
Super User

For Rank Refer these links

https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I have the rank. I only want the Top N rows regardless of ties. If I want the top 20 rows and I filter on rank <= 20, I'll get more than 20 records due to ties.

 

 

Refer How to break ties. If this can help

https://community.powerbi.com/t5/Desktop/RankX-Measure-ties-affecting-Pareto-graph/td-p/476553

https://stackoverflow.com/questions/48727097/break-ties-in-rankx-powerpivot-formula

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks. I wound up breaking the tie by mimicking the MIN example in your link and then adding that to my value in the Rank. Basically guarantees adding less than 1 to every record and thus not distorting the overall rank other than ties.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors