March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
I have the following graph on 3 separate pages of a Power BI report showing the breakdown of a category and sub-category:
The idea is that each page will represent a location (dynamic) based on the user's date selection:
So locations 1, 2 and 3 will dynamically change based on the user's date selection. In the event that two or more locations have the same value then the alphabetical order is taken into, see table below:
So what I need is someway of applying the Rank Measure to the graph above - rank 1 for highest, rank 2 for 2nd highest, rank 3 for 3rd highest. The measures that I have for the count are as follows:
Count Measure:
Count Measure = CALCULATE(COUNT(Issues[Date]),Issues[Not Cancelled] = 1)+0
Rank Measure (I got this from another post in the Community Forum and adapted it for my use case):
Rank Measure =
VAR _table =
I don't know where to apply the Rank Measure so that I can filter the respective graphs on each of those pages. Any help is greatly appreciated.
@PowerBI-Newbie , Use index function. You can use Parameter and measure to make it dynamic
example
Top1 =
calculate([%scrap], KEEPFILTERS(index(1, All(SAPWorkCenter[CDL]), orderby([%scrap],desc) ) ))
Top 2=
calculate([%scrap], KEEPFILTERS(index(2, All(SAPWorkCenter[CDL]), orderby([%scrap],desc) ) ))
Top N=
calculate([%scrap], KEEPFILTERS(index([selected Parameter], All(SAPWorkCenter[CDL]), orderby([%scrap],desc) ) ))
Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U
Hi @amitchandak ,
Thank you very much for your response. It's gotten me half-way there after adapting it for my need.
I have the following measure:
2nd Highest Location =
VAR _2ndValue = INDEX(2,SUMMARIZE(ALLSELECTED(Issues[Location]),Issues[Location], "_count not cancelled",[Count Not Cancelled]),ORDERBY([Count Not Cancelled],DESC))
RETURN
MAXX(_2ndValue,[Location])
This provides me with the name of the location with the 2nd highest value which is excellent and so I wanted to use it in the following measure for the y-axis so that the categories and sub-categories can be filtered based on 2nd highest location:
Count - Not Cancelled 2nd =
CALCULATE(COUNT(Issues[Incident Date]),
Issues[Count If not cancelled] = 1,
Issues[Location] = [2nd Highest Location])+0
But this gives me PLACEHOLDER error and so I tried using variables but it doesn't filter the data properly. However, when I hardcode the value like the following it works perfectly:
Issues[Location] = "Location 2"
I don't know what the issue is.
@PowerBI-Newbie , if this from a connected table, measure can be filtered using a code like
calculate([%scrap], KEEPFILTERS(index(2, All(SAPWorkCenter[CDL]), orderby([%scrap],desc) ) ))
but if you first want to get value and pass it on to another table
calculate([Meausre], filter(Table, Table [Location] = [2nd Highest location]))
if you will use +0, it will show all other location with blank values
Hi @amitchandak,
I hope you're well.
I don't want to create a new question so would greatly appreciate your help with the above query.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |