Forum Discussion
Dynamic Index/Rank (1st, 2nd, 3rd) on Graphs
- 1 year ago
Here is an example of using RANK which allows you to rank by more than one column.
R = var a = ADDCOLUMNS(ALLSELECTED('Table'[Location]),"c",CALCULATE(COUNTROWS('Table'),REMOVEFILTERS('Table'[Asset Type],'Table'[Sub-Type]))) return rank(DENSE,a,ORDERBY([c],DESC,[Location],ASC))is that what you are looking for?
Hi lbendlin,
Thank you for your response.
With regards to your first comment, are you able to assist me with this? I'm not very good with DAX.
As for your question then if the user was to select 22nd December then the graphs would look like this:
1st Ranking - Location 1 has the highest count
2nd Ranking - Location 2 has the 2nd highest count
3rd Ranking - Location 3 has the 3rd highest count
When the user selects 23rd December then the graphs would look like the following:
1st Ranking - Location 1 - despite it being a tie it comes first due to alphabetical order
2nd Ranking - Location 2 - despite it being a tie it comes second due to alphabetical order
3rd Ranking - Location 3 has the 3rd highest
I hope that is clear now.
Here is an example of using RANK which allows you to rank by more than one column.
R =
var a = ADDCOLUMNS(ALLSELECTED('Table'[Location]),"c",CALCULATE(COUNTROWS('Table'),REMOVEFILTERS('Table'[Asset Type],'Table'[Sub-Type])))
return rank(DENSE,a,ORDERBY([c],DESC,[Location],ASC))
is that what you are looking for?
- PowerBI-Newbie1 year agoHelper IV
Thank you very much lbendlin, this is what I'm looking for.