Forum Discussion
Modify the legend order
- 10 years ago
You have to create Measures for each type of Status
Then place each Measure in the Values area in the order you wish
I responded to a similar question but for a pie chart today - it works exactly the same way with a bar chart
http://community.powerbi.com/t5/Desktop/Rearrange-Pies-in-Pie-Chart/m-p/25218#U25218
The above solutions are valid, but I wanted to share my simple method. YMMV.
I have a table of change tickets, and I want to sort them by Risk Level. The values are Low, Medium, High, and Very High. I want to have a stacked column in this order. However, they list alphabetically and stack High, Low, Medium, Very High.
* Create new column called "Risk Sort Order"
RiskSortOrder = SWITCH('Change Tickets'[Risk Level], "Low", 1, "Medium", 2, "High", 3, "Very High", 4)
At this point, if you try to do "Sort By" on the Risk Level column by Risk Sort Order, you get the error that a column can not be sorted by a column it directly or indirectly affects (etc... didn't screen shot it).
* Create another new column called "Risk Level Push" which will be a direct copy of the original Risk Level column
RiskLevelPush = 'Change Tickets'[Risk Level]
* Select Risk Level Push column, Sort by Risk Sort Order
* Change Visual Legend to use Risk Level Push, rename at visual level "Risk Level"
And Viola! Stacks are now in order as desired - Low, Medium, High, Very High.
This method works great when you have a small, finite number of legend items that you can predictably assign values. Obviously, it's not going to work in a dynamic value situation.