Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
Hi,
I'm trying to create a measure that ranks a table based on a score, but I can't seem to get the rank to work as expected. I've looked through threads that have reported similar issues that I have, but the solutions to those threads don't seem to work when applied to my instance.
My table looks like the following:
The report itself consists of a slicer, where you can select between the different KPIs, and a matrix diagram that looks like the following:
What I would like to do is to create a measure that ranks the different stores by doing a sum() of all the ranks (that are in the dataset) that are included in the selected values in the slicer. The Store with the lowest rank should be rated as 1. The ranking should be updated based on the KPIs that are selected in the slicer.
I've created a measure with the following script that seems to work when I've only selected 1 option in the slicer:
Overall Ranking =
RANKX(
ALLSELECTED(Sheet1),
CALCULATE(SUM(Sheet1[Rank])),
,
ASC,
Dense
)
But as soon as I select more options then the ranking seems to return something else. For example in the below screenshot, I've selected 2 options in the slicer. The Score (which is a different measure that I've created and is just a sum() of the ranks of the selected values) indicates that the ranking should be 2, 1, 2, 3, but instead the ranking is 5, 4, 5, 5
When there is only 1 value selected in the slicer, then the ranking looks like the following (which is correct):
Could you help me find out what I'm doing wrong?
Thanks in advance!
Solved! Go to Solution.
Hi @Anonymous ,
Please create new measure to get the sum of Rank, then update the formula of measure [Overall Ranking] as below. Please find the attachment for the details.
Sum of Rank = SUM('Sheet1'[Rank])
Overall Ranking =
VAR tab1 =
SUMMARIZE ( ALLSELECTED ( Sheet1 ), Sheet1[Store], "sumofRank", [Sum of Rank] )
RETURN
RANKX ( tab1, [Sum of Rank],, ASC, DENSE )
Best Regards
@Anonymous not sure why, can you share pbix file, remove sensitive information before sharing.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k I can't upload the file directly to this forum so I hope that a drive link works for you. Thanks for helping me look into this!
https://drive.google.com/file/d/1-tJ_Lf7wvml1FvGR1xdeXAg96c4hdxHD/view?usp=sharing
Hi @Anonymous ,
Please create new measure to get the sum of Rank, then update the formula of measure [Overall Ranking] as below. Please find the attachment for the details.
Sum of Rank = SUM('Sheet1'[Rank])
Overall Ranking =
VAR tab1 =
SUMMARIZE ( ALLSELECTED ( Sheet1 ), Sheet1[Store], "sumofRank", [Sum of Rank] )
RETURN
RANKX ( tab1, [Sum of Rank],, ASC, DENSE )
Best Regards
User | Count |
---|---|
90 | |
88 | |
87 | |
79 | |
49 |
User | Count |
---|---|
153 | |
145 | |
106 | |
74 | |
55 |