Forum Discussion
jmateu88
2 years agoHelper I
Dynamic ranking by different fields
Hello, I am trying to get the ranking of a sum by choosing the field but unfortunately, I do not know how to create a dynamic ranking dax. Here I attach the data. As we can see, there are thr...
- 2 years ago
Hi, jmateu88 Please use the below measure, which dynamically rank different fields.
Rank =VAR _selectedValue = SELECTEDVALUE(Parameter[Parameter Order])VAR _rankCountry = RANKX(ALLSELECTED('Table'[Country]), [TotalAmount])VAR _rankItem = RANKX(ALLSELECTED('Table'[Item]), [TotalAmount])VAR _rankPerson = RANKX(ALLSELECTED('Table'[Person]), [TotalAmount])VAR _Result =SWITCH(TRUE(),_selectedValue=0, _rankItem,_selectedValue=1, _rankPerson,_rankCountry)RETURN_Result
Hope this helps!!
If this solved your problem, please accept it as a solution!!
shafiz_p
2 years agoSuper User
Hi, jmateu88 Please use the below measure, which dynamically rank different fields.
Rank =
VAR _selectedValue = SELECTEDVALUE(Parameter[Parameter Order])
VAR _rankCountry = RANKX(ALLSELECTED('Table'[Country]), [TotalAmount])
VAR _rankItem = RANKX(ALLSELECTED('Table'[Item]), [TotalAmount])
VAR _rankPerson = RANKX(ALLSELECTED('Table'[Person]), [TotalAmount])
VAR _Result =
SWITCH(
TRUE(),
_selectedValue=0, _rankItem,
_selectedValue=1, _rankPerson,
_rankCountry
)
RETURN
_Result
Hope this helps!!
If this solved your problem, please accept it as a solution!!
Hope this helps!!
If this solved your problem, please accept it as a solution!!