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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
rlansing
Resolver I
Resolver I

DAX: Rank measure needs tweaking

I just posted a question about running totals, but I have another about my rank measure. Here is what I posted earlier about my Data Model:

I am trying to model my data, which is approximately 7 million rows of product movement data. Included in the dataset are references to Shipment Date, Warehouse Number, Store Number, Product information (UPC), and the quantity of cases shipped.

 

I need help on multiple measures (I am reading Building Data Models with PowerPivot 2015 edition). For this problem I have a Matrix table showing Product description, Qty, Year Previous Qty, the % change between the two, a Product Ranking.

 

My Item Rank measure looks like this:

Qty Rank = IF ( HASONEVALUE( UniData[Desc] ) && [TotQty] > 0, RANKX ( ALLSELECTED( UniData[Desc] ), [TotQty] ), BLANK() )

 

This measure works great until the table is filtered to one item. Then of course the rank goes to 1. My intent is to rank the items within a Manufacturer (as a group). How can I change the measure to rank all items within a group (in this case as a manufacturer) regardless of whether they are being displayed or not?

 

Thank you!

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

Did you try ALL instead of ALLSELECTED?

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

Posting a sample of your data would go a long way to understanding your issues and supplying good advice.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Well, I would post an example, but you solved my problem. Seems pretty trivial now.

 

Thank you very much for your help!

Greg_Deckler
Super User
Super User

Did you try ALL instead of ALLSELECTED?

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.