Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Below is a stacked bar chart
Top N is applied here and i want to sort the legends as per the bars. Any suggestions ?
Solved! Go to Solution.
Hi @uj91,
Currently in Power BI, we can sort the bars in a stacked bar chart by value using Format → Layout → Sort by value. However, the legend order cannot be sorted based on the values shown in the chart.
The legend order always follows the order of the column used in the Legend field or the model sort order. It does not change dynamically based on Top N or measure values.
As a workaround, you can:
Control a fixed legend order using Sort By Column the data model, Use a separate table visual as a custom legend and sort it by value .Adjust Reverse order if stack direction helps visually legend order will still remain same.
So to confirm, sorting bars by value is supported, but sorting legends by value is not supported in Power BI at the moment.
A similar issue was discussed earlier. Please go through that thread, it may help resolve your issue.
Solved: Sort legend by value of legend items? - Microsoft Fabric Community
Hope this clarifies. Let us know if you want to explore any workaround further.
Regards,
Community Support Team.
Hi @uj91,
I would also take a moment to thank @danextian , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.
Regards,
Community Support Team.
Hi @uj91,
I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We are always here to support you.
Regards,
Community Support Team.
Hi @uj91
In the formatting pane, there is an option under layout to sort the bars by value
I need the legends to be sorted as per the values as well. any suggestions ?
Hi @uj91,
Currently in Power BI, we can sort the bars in a stacked bar chart by value using Format → Layout → Sort by value. However, the legend order cannot be sorted based on the values shown in the chart.
The legend order always follows the order of the column used in the Legend field or the model sort order. It does not change dynamically based on Top N or measure values.
As a workaround, you can:
Control a fixed legend order using Sort By Column the data model, Use a separate table visual as a custom legend and sort it by value .Adjust Reverse order if stack direction helps visually legend order will still remain same.
So to confirm, sorting bars by value is supported, but sorting legends by value is not supported in Power BI at the moment.
A similar issue was discussed earlier. Please go through that thread, it may help resolve your issue.
Solved: Sort legend by value of legend items? - Microsoft Fabric Community
Hope this clarifies. Let us know if you want to explore any workaround further.
Regards,
Community Support Team.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 62 | |
| 53 | |
| 42 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 122 | |
| 104 | |
| 45 | |
| 31 | |
| 24 |