Forum Discussion
Sorting in a stacked bar chart
- Anonymous6 years ago
Hi MarcUrdang ,
So assume the picture below is raw visual.
You want the visual sort by legend i.e show as 20200201 c, b, a; 20200102 c, a, b; 20200103 a, b, c; etc... Am i right?
In that case i'm afriad this can't be done in Power BI currently.
About this feature, there are several ideas have been submit , you can vote for them.
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/31937392-legend-manual-sorting.
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/37921429-sort-order-legend.
Best Regards,
Jay
Community Support Team _ Jay Wang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey MarcUrdang
You are wanting to sort the "Colors" in the individual bars (columns) in the visual correct?
If you are simply wanting to change the order of the axis you can click the "..." in the corner of the visual and click "Sort by".
Also try the solution in this link to see if ti answers your question: https://community.powerbi.com/t5/Desktop/How-to-sort-stacked-column-chart-in-Power-BI-desktop/td-p/300778
If this helps please kudo.
If this solves your problem please accept it as a solution.
Hi
Yes its already sorted by date on the x axis .. I want a secondary sort in each column based on a criteria ie volume, count etc
- Anonymous5 years agoNot applicable
I realize this question is a year old, but I found it while looking for a solution to a similar problem, and I think I might have the solution to THIS problem...so I'm sharing it for posterity. 🙂
I think the best solution for your situation would be this: instead of creating one visual with multiple stacked bars, create several visuals with one stacked bar each. You can sort each bar by the volume or count or whatever your key criterion is, then manually place the bars from left to right in order of date. You can even insert shapes and text boxes to imitate the look of the shared x-axis that you would get if you'd stuck with a multiple-stacked-bar visual.
This isn't a perfect solution, especially if the report will be used continuously for a long time while new time periods (quarters, for example, if each bar represents a quarter) pass. If that's the case, you would have to manually add a new stacked bar visual for each new time period as it occurs, which is obviously not ideal. But if either a) you can't figure out another way to do this and it's SUPER important to achieve this by-bar sort, or b) the report will only be used for a limited amount of time and doesn't need to update and add new bars as time passes, this could be a perfectly workable (if inelegant) solution.