Forum Discussion
Sorting X-axis Type option in the Stacked Bar Chart
Hi All,
When sorting the stacked bar chart, found that if Type of x-axis is Continuous, we get like this.
However, the get the sorting enabled, we need to change the x-axis Type to Catgeorical.
I hope if someone trying without Type of x-axis can get sorting work.
Best Regards,
Vishwanath
Hi vishwanath-v,
Thank you Anonymous, for your insights.
The issue you’re seeing is due to how Power BI manages axis types. When the X-axis is set to Continuous, it shows data based on a numeric or date scale, keeping the natural order of values. If you use a Categorical axis, each value becomes a separate category, letting the data be grouped distinctly. This difference affects sorting, so switching to a categorical axis helps the visual sort values as intended.
Customize X-Axis and Y-Axis Properties - Power BI | Microsoft Learn
Thank you.
8 Replies
- Ritaf1983
Super User
Hi vishwanath-v
If you need to sort by age,
Just select the age as a sort axisIf by value , it should be categorical axis.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
- danextian
Super User
Hi vishwanath-v
It isn't currently possible to sort the x-axis while it is set to continuous. It is possible only with categorical.
- AnonymousNot applicable
In your 2nd example you have asked it to sort by Employee Count rather than by Age. Is that the problem you are trying to solve? If thats the problem, you just need to click the "Age" option in the menu that you can see inside your screenshot.
- v-saisrao-msft
Community Support
Hi vishwanath-v,
Thank you Anonymous, for your insights.
The issue you’re seeing is due to how Power BI manages axis types. When the X-axis is set to Continuous, it shows data based on a numeric or date scale, keeping the natural order of values. If you use a Categorical axis, each value becomes a separate category, letting the data be grouped distinctly. This difference affects sorting, so switching to a categorical axis helps the visual sort values as intended.
Customize X-Axis and Y-Axis Properties - Power BI | Microsoft Learn
Thank you.
- v-saisrao-msft
Community Support
Hi vishwanath-v,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.
- cengizhanarslan
Super User
Sorting by a measure is not supported when the X-axis is set to Continuous. There’s no way to enable measure-based sorting while keeping a continuous axis.
- mj29109Regular Visitor
This is posible you just need to Create a sort column (for controlled ordering)
If you're working with dates or numbers but still want control:
- Convert your axis field into a text or category
- Create a Sort By Column in your model
Example:
- Month Name → sort by Month Number
- v-saisrao-msft
Community Support
Hi vishwanath-v,
Checking in to see if your issue has been resolved.if not share the PBIX file let us know if you still need any assistance.
Thank you.