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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Line chart orderd by a month

I have a chart per month and over three years. When I want to order them so months appear from Jan to December, I am getting an error. How else can I fix it?

 

MaWrob_0-1732627696785.pngMaWrob_1-1732627720118.pngMaWrob_2-1732627746789.pngMaWrob_3-1732627763829.png

 

1 ACCEPTED SOLUTION
WishAskedSooner
Resolver II
Resolver II

There are a couple of ways to do this. One easy, the other complex.

 

From your screenshot, you are clearly using a column for the X-axis that Power BI interprets as text which is why Power BI sorts it alphabetically. This is likely because you created a calculated column from your Date column using the FORMAT() function which transforms the Date to text. This is not best practice (see the first option below).

 

The first option is to simply use a Date column of your table as the X-axis with the formatting set to however you want it displayed in the GUI. This will maintain the Date type and Power BI will then order by date versus alphabetically in your screenshot. I strongly encourage this solution before pursuing the next.

 

The second involves creating a sort column that matches the granularity precisely and sorting the column that Power BI is interpreting as text on the newly created sort column. This requires special care though because Power BI is buggy. Knowing how to do this however is important when one needs to custom sort actual text/labels.

View solution in original post

3 REPLIES 3
WishAskedSooner
Resolver II
Resolver II

Awesome! Glad to see you got it working. Unfortunately, this behavior is not well documented and nearly every new developer encounters it at some point, only to find themselves endlessly struggling especially because of the unresolved bugs (and I speak from experience).

WishAskedSooner
Resolver II
Resolver II

There are a couple of ways to do this. One easy, the other complex.

 

From your screenshot, you are clearly using a column for the X-axis that Power BI interprets as text which is why Power BI sorts it alphabetically. This is likely because you created a calculated column from your Date column using the FORMAT() function which transforms the Date to text. This is not best practice (see the first option below).

 

The first option is to simply use a Date column of your table as the X-axis with the formatting set to however you want it displayed in the GUI. This will maintain the Date type and Power BI will then order by date versus alphabetically in your screenshot. I strongly encourage this solution before pursuing the next.

 

The second involves creating a sort column that matches the granularity precisely and sorting the column that Power BI is interpreting as text on the newly created sort column. This requires special care though because Power BI is buggy. Knowing how to do this however is important when one needs to custom sort actual text/labels.

Anonymous
Not applicable

Thanks a lot - it worked!

MaWrob_0-1732629718557.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.