Forum Discussion
Truly bizarre - adding legend breaks custom sort on X axis
HM615 Hello,
You can follow below steps
1) Adjust X-Axis settings: Go to the X-Axis settings in the scatter chart (under the Format pane) and make sure it is set to show in the order you want, either as Categorical or Continuous,
2) Ensure the Legend is Not Interfering with X-Axis Sorting: Check your legend and see if Power BI is treating the legend categories as a hierarchy. You can try removing the legend from the scatter chart temporarily to see if the issue persists. If it does, it’s likely an issue with how Power BI is combining the X-axis and legend.
3) you could create a new calculated column that combines the week and year, ensuring the order is independent of the legend.
Thanks
Harish M
Did I answer your question? Mark my post as a solution! and Give kudos
- HM6151 year ago
Advocate I
The legend is interfering with the X-axis sorting. That is exactly what is happening. Apologies if I didn't explain it very clearly, but that's exactly the issue - Power BI is treating the legend categories as a hierarchy. I don't know how to make is stop doing that.
Thank you for your suggestion. It would indeed work to combine the week and year into a new column (then write new measures based on that column, bring them in as values rather than as the Y-axis and legend as I'm currently doing, then format them all indvidually into different colours to make it clear) but it seems a heck of a faff to override a feature that has no possible use in any scenario I can imagine! The way I have got round it was to change it to a line chart, instead of scatter graph, and fiddle with the formatting so there are markers but no lines, and it looks like a scatter graph. For no apparent reason, line charts don't treat the legend categories as a hierarchy the way that scatter graphs do. So I have managed to find another way around it - it just seems like such a bizarre setting!
I'm curious if anyone knows a way to turn this off. Still can't understand why anyone would ever want the legend categories to be treated as a hierarchy that overrides the specified sort order!