Forum Discussion
Anonymous
9 years agoNot applicable
Rank a column in a table based on slicer selection
Here is a sample picture of the report I'm building. What I want to do is show the top [selected number] (5/10/50/100) operators ranked by the selected metric, For example if I selec...
- 9 years ago
Hi Anonymous,
How many metrics are there in your scenario? If they are not too many and there is no a better solution, I would suggest you to use SWITCH function in this case. The formula below is for your reference.
Rank = VAR SelectedMetric = FIRSTNONBLANK ( Filters[Name], 1 ) RETURN SWITCH ( SelectedMetric, "Metric1", RANKX ( ALL ( Table[Operator] ), Metric1,, DESC, DENSE ), "Metric2", RANKX ( ALL ( Table[Operator] ), Metric2,, DESC, DENSE ), "Metric3", RANKX ( ALL ( Table[Operator] ), Metric3,, DESC, DENSE ), RANKX ( ALL ( Table[Operator] ), Metric1,, DESC, DENSE ) )Regards
v-ljerr-msft
Microsoft Employee
9 years agoHi Anonymous,
How many metrics are there in your scenario? If they are not too many and there is no a better solution, I would suggest you to use SWITCH function in this case. The formula below is for your reference.
Rank =
VAR SelectedMetric =
FIRSTNONBLANK ( Filters[Name], 1 )
RETURN
SWITCH (
SelectedMetric,
"Metric1", RANKX ( ALL ( Table[Operator] ), Metric1,, DESC, DENSE ),
"Metric2", RANKX ( ALL ( Table[Operator] ), Metric2,, DESC, DENSE ),
"Metric3", RANKX ( ALL ( Table[Operator] ), Metric3,, DESC, DENSE ),
RANKX ( ALL ( Table[Operator] ), Metric1,, DESC, DENSE )
)Regards
AdamIzzo
7 years agoRegular Visitor
Brilliant solution thank you!