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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Nats_17
New Member

Problem with RANKX while applying top n in filter pane

Hello!
I'm experiencing some trouble with my report. I have the following measures:

Total Gross Profit = SUM(Dane[Order Gross Profit])

and

Subcategory Rank =
RANKX(
    ALL(Dane[Subcategory Name]),  
    [Total Gross Profit], 
    ,
    DESC 
)

when i create a matrix visual with all subcategories, the ranks are correct, as shown below:
Nats_17_0-1736552150696.png


However when i go to the filter pane and filter subcategories to top 5 by total gross profit:

Nats_17_1-1736552216517.png


something weird happens:

Nats_17_2-1736552240923.png

I would like to see subcategory rank as before applying the top n filter.
I have no idea how to fix it and would really appreciate some support.






1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Nats_17 ,
Thanks for Ashish_Mathur reply.
Here is another way to troubleshoot this

You can use the ranked MEASURES as a basis to get the top five profits, as shown below, and you can display the last five figures in sub-sort order

vheqmsft_0-1736745899192.png

 

If you still can't solve the problem, you can provide the full example data so we can help you faster. Please hide sensitive information in advance.

 

Best regards,
Albert He


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

2 REPLIES 2
Anonymous
Not applicable

Hi @Nats_17 ,
Thanks for Ashish_Mathur reply.
Here is another way to troubleshoot this

You can use the ranked MEASURES as a basis to get the top five profits, as shown below, and you can display the last five figures in sub-sort order

vheqmsft_0-1736745899192.png

 

If you still can't solve the problem, you can provide the full example data so we can help you faster. Please hide sensitive information in advance.

 

Best regards,
Albert He


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

 

Ashish_Mathur
Super User
Super User

Hi,

In your measure, change ALL to ALLSELECTED


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.