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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dynamic Rank Order

I'm working with a dataset of 4.5 million entries, spanning 3 years and multiple other criteria that I'd like to slice the data on.  Where I'm struggling is trying to get the financial values to re-rank based off the criteria selected.

 

I have the following fields in my data, all in one table:

PID: unique identifier for each person, may be duplicated across years but not within a single year

OM: sum of the financial value for each person in a given year

Year: the three years (2018-2020) in my dataset

Age: Person's age

Gender: Person's gender

Category: A buyer classification

 

Example (dummy) data:

MQCrawford_0-1630344212114.png

 

At a bare minimum, I'd like to rank order OM and be able to see all three years or filter to a single year. 

Example: Ordering within year 2018

MQCrawford_0-1631039149018.png

Ranking across the whole dataset:

MQCrawford_1-1631039199181.png

Ideally, I'd like to apply other filters, such as Category. 

MQCrawford_2-1631039294090.png

 

Do I need to create a new measure or column for every subset I want to explore?  Can I create one dynamic function that will recalculate when different filters are applied?

 

Thanks,

Michael

5 REPLIES 5
v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this measure

Rank = RANKX(ALLSELECTED('Table'),CALCULATE(SUM('Table'[OM])),,DESC,Dense)

4.png6.png

 

 

 

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

Hi Stephen,

Thank you for your help with this.  I tested your solution and it works on the test data.  Unfortunately, when I apply it to the full dataset, I'm getting strange results (see below).

MQCrawford_1-1631116922725.png

 

This is on the unfiltered data (so, all years 2018-2020).  As you can see, there's a tied rank for #7 and #19, even though the OM values are different.  The rank ordering also skips #13 for no apparent reason.

Do you have any ideas as to what is causing this?

v-stephen-msft
Community Support
Community Support

Hi @Anonymous ,

 

What is your corresponding expected result? Please give the expected results in tabular form.

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

I've updated the original post with more information on intended results.

PaulDBrown
Community Champion
Community Champion

Please follow the recommendations in this thread to help us help you:

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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