Forum Discussion
Display legend order by Y-Axis value
Hi PowerBI experts,
I've a line chart as below:
X-Axis are days
Y-Axis are errors Count
Legends are from Column "Errors" and the errors list might be different every day.
I hope the chart order the legend by the count.
For example, for data below, by default the line chart would order the legend by Errors' alphabetical sequence. What I hope is:
1. If you select 12.06, the lengend order is [BError, AError]. If you select 12.07, the legend order is [CError,Error]. The legend is ordered by its count.
Day Errors Count
12.06 AError 2
12.06 BError 10
12.07 CError 25
12.07 AError 5
I checked some discussions https://community.powerbi.com/t5/Desktop/Rearrange-Pies-in-Pie-Chart/m-p/25218#U25218 but this solution doesn't work for me as our legends would change every day and not fixed value.
6 Replies
- tringuyenminh92
Memorable Member
Hi huzhan,
If count field is not a calculated measure field (could be calculated column or default value field), you could use Sort by column in Modeling tab -> Sort by column -> choose another order column to sort
If this works for you please accept it as solution and also like to give KUDOS.
Best regards
Tri Nguyen- huzhanNew Member
Thanks , but this doesn't work for me:
1. Count is the raw column from backend table, but the "Sort By column" in Modeliing tab is grey for me and not clickable
2. If I click the ellipse at the chart and select sort by count, then the X-Axis would mess up. What I want is the X-Axis still sorted by Day
- tringuyenminh92
Memorable Member
Hi huzhan,
Please choose the field you want to sort firstly, after that, the sort by column button will be available.