Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
EricMamet
Helper I
Helper I

Problem with sorting X-Axis on simple Line chart

I try to display measures with an axis made of Months in the format YY-MM

 

ascending.png

If I sort in Ascending order, May 2021 ends up after Dec 2021...

 

If I sort descending, it's still wrong!

descending.png

  Any idea why is the X axis not sorted properly?

 

 

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @EricMamet ,

 

please check you "Sort by"

 

Sort by.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

4 REPLIES 4
EricMamet
Helper I
Helper I

Indeed, it was solved by using the sort... option.

 

I would have thought logical to order by default by my X Axis values but it was not the case.

 

Thanks

themistoklis
Community Champion
Community Champion

X axis is text and not a number that's why during sort it is messing up the order.

Try to create a new column where YearMonth will be in the following formay YYYYMM.

 

 

YearMonth= FORMAT('Calendar'[Date], "YYYYMM")

 

Make sure it is of datatype 'wholenumber' and not text

Now Go to model section and sort the column which is shown on X axis in the diagram based on the newly created column. See image below

Sort.png

 

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @themistoklis ,

 

this should not be the problem, because even in alphanumeric sorting the dates have the correct order.

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


mwegener
Most Valuable Professional
Most Valuable Professional

Hi @EricMamet ,

 

please check you "Sort by"

 

Sort by.png

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.