Forum Discussion
Anonymous
5 years agoNot applicable
Rank stacked column chart
Hi, Currently , I have stacked column chart below. The order of legend is defaultly as A-Z. How to rank the legends based on the YTD for every legend? Thanks for any help 🙂...
- 5 years agoYou could use RANKX to create a calculated column that ranks each category. You just have to make sure that each category only has 1 rank, so every year for that category and every month it must be the same number ranking.
Then you can use Sort By Columns to sort the category by rank and the legend will automatically update.
https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column
You may also be interested in Ribbon chart, which shows relative rank for each category and how it has changed from month to month: https://docs.microsoft.com/en-us/power-bi/visuals/desktop-ribbon-charts
amitchandak
5 years agoSuper User
Anonymous , I think legend sorting happens alphabetically. Check if there any idea https://ideas.powerbi.com/ideas/
Anonymous
5 years agoNot applicable
Thanks for your reply.
I may ask in another way, I know the legend sorting is not possible.
What if I rank them in a table? and then sort them as the rank column? is it possible?
- AllisonKennedy5 years agoCommunity ChampionYou could use RANKX to create a calculated column that ranks each category. You just have to make sure that each category only has 1 rank, so every year for that category and every month it must be the same number ranking.
Then you can use Sort By Columns to sort the category by rank and the legend will automatically update.
https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column
You may also be interested in Ribbon chart, which shows relative rank for each category and how it has changed from month to month: https://docs.microsoft.com/en-us/power-bi/visuals/desktop-ribbon-charts