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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.