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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mbmcdonald2
Helper I
Helper I

Dynamically rank calculated measure based on different groupings

Hi All, 

I'm having some trouble getting my rank to work properly and was hoping for some assistance. As you can see below, my Industry Per Caps Rank column is not what you would expect. I'd like the per caps rank for product A to be 1, product B to be 2, and so on. My formula is below as well. Does anyone know what I may be doing wrong here? I also want the ranking to update dynamically based on the slicer I'm using (e.g., instead of product, rank by manufacturer, etc). Any help would be greatly appreciated!!

 

Industry Per Caps Rank = rankx(allselected('Nielsen (excl. dist)'),[Per Caps],,DESC,Dense)

 

 

ProductIndustry Per CapsIndustry Per Caps Rank
A2.552
B1.865
C1.687
D1.627
E1.557
F1.547
G1.1911
H0.7716
I0.5817
J0.4819
K0.4619
L0.421
M0.2628
N0.0782
1 ACCEPTED SOLUTION

Hi,
Please check
Recording 2024-10-31 at 02.26.08.gif

PBI File : https://easyupload.io/fxanxw



Regards,
Sachin
Check out my Blog

View solution in original post

17 REPLIES 17
SachinNandanwar
Solution Specialist
Solution Specialist

DynamicRank =
RANKX (
    ALLSELECTED ( 'product_industry_per_caps' ),
    CALCULATE ( MAX ( 'product_industry_per_caps'[Product] ) ),
    ,
    ASC,
    DENSE
)

 

Recording 2024-10-25 at 02.01.27.gif



Regards,
Sachin
Check out my Blog

Hi Sachin!

 

Thanks so much for your quick response. Would there be a way to build the formula to be able to swap out [product] column for other columns? For example, let's say I want to see per caps figures by [region] instead of [product]. Is this possible? I appreciate your insight!

Yes..

DynamicRank =
RANKX (
    ALLSELECTED ( 'product_industry_per_caps' ),
    CALCULATE ( MAX ( 'product_industry_per_caps'[Region] ) ),
    ,
    ASC,
    DENSE
)


Regards,
Sachin
Check out my Blog

Hi Sachin,

 

I tried your approach and it's still looking like it's not ranking correctly. Any further guidance would be greatly appreciated. Thank you!Screenshot 2024-10-28 094000.png

Can you share the PBI file ?If you can then please share it on Google drive or One drive



Regards,
Sachin
Check out my Blog

Hi Sachin, 

 

Try seeing here. Thank you! 

Can you grant access to the file ?



Regards,
Sachin
Check out my Blog

Hi Sachin!

 

Thanks so much - see if this link works here

Please check the screengrab.


Recording 2024-10-29 at 01.56.15.gif

PBI file uploaded here : https://easyupload.io/tl3qnh



Regards,
Sachin
Check out my Blog

Hi Sachin, Thanks so much for the help here. Is there a way to build out this rank in the original Nielsen(excl. dist) table? I need this ranking/visual to adjust with different filters brought in. For example, if I added [Zone] as a filter, I'd like for this to update based on each zone. 

Hi, Is this what you are looking for ?

Recording 2024-10-30 at 03.54.49.gif
Or this ?
Recording 2024-10-30 at 04.00.21.gif



Regards,
Sachin
Check out my Blog

Hi Sachin! Thank you so much for your ongoing help. I'm looking for the bottom solution (but built with the ability to view by: category, sub-category, zone, channel, manufacturer) - essentially all the attribute fields listed in Nielsen (excl. dist) table. Do you know if there is a way to do this? Thank you!

Hi,
Please check
Recording 2024-10-31 at 02.26.08.gif

PBI File : https://easyupload.io/fxanxw



Regards,
Sachin
Check out my Blog

Hi Sachin!

 

Thanks so much for the response. I'd like to know if there is a way to set up the formula to be able to swap out the column (e.g., [region], [sub-category]) dynamically based on the visual (without needing to write a separate formula for each rank). Thank you!

You can do it through field parameters.

https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters



Regards,
Sachin
Check out my Blog

Thanks so much, Sachin! Do you know if there is a way to set up a parameter for the whole dashboard page (as opposed to just one visual)? 

Please create a new topic for new requirements.Different requirements are getting jumbled up in one topic.



Regards,
Sachin
Check out my Blog

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors