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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
harsh_bi_dev
Frequent Visitor

Help with RANKX

Hello everyone,

 

I am facing an issue with the RANKX DAX.

 

My requirement is to get best performing months year based on the total sales for each consultant with their respective locations and then I need to display TOP 50 records from this recordset based on Total Sales.

 

I am able to get best performing month year for each consultant with their respective locations by using RANKX function. Now I want to get only TOP 50 records from this record set in my table.

 

Below is my DAX to get best performing month year:

Rank Month Year = 
RANKX(
    CALCULATETABLE(
        VALUES('T1'[Month Year]),
        ALLSELECTED('T1'[Month Year])
    ),
    [Total Sales],,
    DESC,
    Dense
)

 

I am applying visual level filter that value of this measure should be 1. By this way I am getting the best performing month.
 
Can anyone help me out with how I can get TOP 50 records based on Total Sales after getting all the best performing months?
 
Thanks in advance
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @harsh_bi_dev ,

 

You can create a new measure as 

 

 

Measure = IF([Rank Month Year]<=50,1)

 

 

 

Then put this measure into Filters, and set show items when the value is 1

11.png

You can see the simple sample from the attachment.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @harsh_bi_dev ,

 

You can create a new measure as 

 

 

Measure = IF([Rank Month Year]<=50,1)

 

 

 

Then put this measure into Filters, and set show items when the value is 1

11.png

You can see the simple sample from the attachment.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@harsh_bi_dev 

You can incorporate with IF function if you are showing the measure against each consultants

 

=IF ( [Rank Month Year] <= 50 , [TOTAL SALES] )

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hello @Fowmy,

 

Thanks for the quick reply. But it will not solve my problem. I want TOP 50 groups of Location, Consultants and Month Year.

 

Hope this makes sense.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.