Forum Discussion
Rankx Not working as expected when data is filtered using slicers and filter pane
- Anonymous1 year ago
Hi Vivek26
Please check this measure. Although it is not concise enough, it seems to meet your requirements.
rank = var currentDistrict = SELECTEDVALUE(Store[District]) var sumTable = SUMMARIZE(ALLSELECTED(Store),Store[Region],Store[District],"Total_Amount",[Total Sales]) var rankTable = ADDCOLUMNS(sumTable,"Rank_Value",RANK(DENSE,sumTable,ORDERBY([Total_Amount],DESC))) return MAXX(FILTER(rankTable,[District] = currentDistrict),[Rank_Value])I struggled a lot but haven't figured out a method with RANKX yet. Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
If you filter a specific store in a district, we will again start getting rank 1 for everything . That is my main point of concern.
In a district we want to exclude certain stores .
Hi Vivek26
Please check this measure. Although it is not concise enough, it seems to meet your requirements.
rank =
var currentDistrict = SELECTEDVALUE(Store[District])
var sumTable = SUMMARIZE(ALLSELECTED(Store),Store[Region],Store[District],"Total_Amount",[Total Sales])
var rankTable = ADDCOLUMNS(sumTable,"Rank_Value",RANK(DENSE,sumTable,ORDERBY([Total_Amount],DESC)))
return
MAXX(FILTER(rankTable,[District] = currentDistrict),[Rank_Value])
I struggled a lot but haven't figured out a method with RANKX yet. Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!