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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
rlansing
Resolver I
Resolver I

RANKX question

Hello,

I am refining a DAX measure that calculates a product's rank within a group of products. Here is my current measure:

$ Rnk = IF([$ Vol] > 0 && HASONEVALUE( Products[Product] ),
   RANKX ( ALL( Products[Sub-Cat], Products[Product], Products[UPC], Products[Brand] ), [$ Vol] ) , BLANK() )

 

I am trying to remove any filter context on the various characteristics of the product, so that an item's rank does not change when the list is filtered. The problem I have is that there are almost 100 product characterstics that could be filtered, and I would like my RANKX measure to maintain a static rank, regardless of the products being filtered. The above measure works great until a column not referenced in the ALL list is filtered.

 

The only filters I want the RANKX measure to obey are "Market" "Date" "Sub-Cat". I have been trying to use ALLEXCEPT, but I cannot get it working, everything keeps showing up as 1.

 

Thanks for the help!

1 ACCEPTED SOLUTION
MattAllington
Community Champion
Community Champion

Maybe I am missing something. Why can't you use this

 

Rankx(all(product), etc

 

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

View solution in original post

2 REPLIES 2
MattAllington
Community Champion
Community Champion

Maybe I am missing something. Why can't you use this

 

Rankx(all(product), etc

 

 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Thanks Matt. Now it seems trivial. Because I just want to honor the filter on the Sub-Category, I am now using

RANKX (ALLEXCEPT (Products, Products[Sub-Cat]), [$ Vol] ) etc....

 

I was trying to use ALL but applied it to the Fact table not the dimension table.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors