Forum Discussion
jstanten
3 months agoNew Member
Dual Sorting for Stacked Bar Chart
I have a stacked bar chart with the x axis sorted by date, in ascending order. However, i want the stacked bar chart legend to be sorted by value, not by alphabetical order. There seems to be an out ...
- 3 months ago
There is no native workaround that fully solves this. You could create a calculated column or Power Query column that assigns a sort rank based on total value across all dates:
LegendRank = RANKX ( ALL ( 'Table'[LegendField] ), CALCULATE ( SUM ( 'Table'[Value] ) ), , DESC, DENSE )Then sort your legend field by this LegendRank column via Column tools → Sort by column. This will not be dynamic per date (it sorts by overall total), but it gets the highest-value categories to the top of the stack consistently.
DanieleUgoCopp
3 months agoSuper User
Hello,
If the proejct permit it, you can create a legend with another visual, like a table, and try to link it to the chart, if you want to make disappear something with filter or whatver is needed,
or creating a ranking column in the model for a fixed order,
or to use a custom visual downloading some visual exterally
Best Regards,
Daniele