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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

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

Share with Power BI Enthusiasts: 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

Share with Power BI Enthusiasts: 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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