Forum Discussion
Change Legend Order in Line and Stacked Chart Visual
Hi everyone,
I am having trouble with rearranging the legend in a line and stacked chart visual. The default for the visual is that they put the legend for the line at the end of the legend list, but I want to put them in front and I am not sure how to do this. I have about 20 items on the list and the data for the line is more important. Below is a picture of what I want to achieve.
4 Replies
- parry2kSuper User
vicente-iii afaik it is not possible, may be you want to put this as an idea on ideas forum or vote if an idea already exists.
- v-lili6-msftCommunity Support
hi vicente-iii
You could use Sort by column in power bi desktop to get it.
https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column
Just add a sort column for legend field in edit queries or in the data source
Then set sort by column for it.
Here is my sample pbix file, please try it.
BeforeAfter
Regards,
Lin
- vicente-iiiHelper I
HI v-lili6-msft ,
Thanks for the reply. Let's say I have a line called E which is the target value for different months. It will have a legend called E. If I want to put that legend as the first legend the user will see, is this possible?
I am unable to achieve this using the sort by column function as the values used in the y-axis of the column chart (actual values) are different from the y-axis of the line chart (target values) - they are in different columns. And I want to bring the legend for the target values forward to be the first in the legend list.
- v-lili6-msftCommunity Support
hi vicente-iii
After my research, it could not be achieved in power bi for now.
The sort of lenged of Line and Stacked Chart Visual will be column in the front, then show line.
you may put it as an idea on ideas forum or vote if an idea already exists.
Regards,
Lin