Forum Discussion
TOP N Slicer Isn't Working
- Anonymous2 years ago
Hi Akshay08
amitchandak Thank you very much for sharing!
Based on the image you uploaded, it seems that you are using a matrix visual with Region and Customer Name in the rows, and _Sales and _Rank Based on sales in the values. You also have a slicer for TopN Value.
One possible reason why your _Sales value changes when you pull Customer Name in the visual is that you are using ALLSELECTED in your _Rank Based on sales measure.
This means that the ranking is based on the filter context of the visual, which includes both Region and Customer Name. Therefore, when you expand a region, you are actually seeing the rank and sales of each customer within that region, not the rank and sales of the region itself.
To fix this, you can change your _Rank Based on sales measure to use ALL instead of ALLSELECTED. This will ignore the filter context of the visual and rank the regions based on the total sales, regardless of the customer name. Here is the modified measure:
_Rank Based on sales = RANKX( ALL(Orders[Region]),[_Sales],,DESC,Dense)You can view the link below for more details:
ALLSELECTED function (DAX) - DAX | Microsoft Learn
ALL function (DAX) - DAX | Microsoft Learn
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Akshay08
amitchandak Thank you very much for sharing!
Based on the image you uploaded, it seems that you are using a matrix visual with Region and Customer Name in the rows, and _Sales and _Rank Based on sales in the values. You also have a slicer for TopN Value.
One possible reason why your _Sales value changes when you pull Customer Name in the visual is that you are using ALLSELECTED in your _Rank Based on sales measure.
This means that the ranking is based on the filter context of the visual, which includes both Region and Customer Name. Therefore, when you expand a region, you are actually seeing the rank and sales of each customer within that region, not the rank and sales of the region itself.
To fix this, you can change your _Rank Based on sales measure to use ALL instead of ALLSELECTED. This will ignore the filter context of the visual and rank the regions based on the total sales, regardless of the customer name. Here is the modified measure:
_Rank Based on sales = RANKX( ALL(Orders[Region]),[_Sales],,DESC,Dense)
You can view the link below for more details:
ALLSELECTED function (DAX) - DAX | Microsoft Learn
ALL function (DAX) - DAX | Microsoft Learn
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Nono,
Thanks for your input. It worked for me with some changes.