Forum Discussion
Rearrange 100% Stacked Bar Legend order when utilising negative values. (Survey Data)
Hey!
I have a bit of a conundrum. I have a 100% stacked bar graph in PowerBI that shows some dummy survey data. I want to order the legend in the format "Strongly Disagree," "Disagree," "Agree," and "Strongly Agree," but due to the negative values, PowerBI seems to sort the measures in the graphic oddly.
To get the graphic looking correct, I have to swap "Disagree" and "Strongly Disagree" around in the "X-Axis" field, this in turn breaks the legend order.
I can "correct" the X-Axis order but this breaks the graphical order for some reason.
The "Legend" option on the graphic isn't receptive to any field I have tested.
Any assitance would be brilliant!
Best,
Sam
3 Replies
- ajohnso2
Solution Supplier
Within transform data create a new numeric column to sit alongside your descriptions.
Description
Description Sort Order Strongly Disagree 1 Disagree 2 Agree 3 Strongly Agree 4 Once this is done, from within the data view pane set the Order By on Description to use the numeric value of Sort order.
Then within your visual, click the 3 dots (top right of visual) and set to sort by Description
- ajohnso2
Solution Supplier
If your descriptions are in their own dimension table (you can create this in power query if you dont have one). Join it to your fact data on description. You can then use the description from your new dimension table as the legend in your chart to make use of the sort order.
Are you able to share your pbix?