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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sort chart months up until current date

Hi,

 

I want to show some data which has sales amount from the previous 12 months on a column chart. When I add all my data to the chart it automatically sorts the columns from January-December even though September-Decembers data is from the year previous.

 

below is how the data is set out.

 

1.png2.png

Thanks,

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

you have to use a column for the x-axis that also contains the year.

 

You can create a Calculated Column using the DAX statement: 

 

Year-Month = FORMAT('<tablename>'[MonthDate] , "YYYY-MM")

This will create something like this "2018-09" and will represent September 2018. You might want to create two columns one containning the year and one containing the month name (please be aware that the month name has to be sorted by a month number: https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column#sort-using-the-sort-by-column-butto...)

To create a chart like this:


image.png

 

it's necessary to create two additional columns that contain the year and the month. To create a calculated column that contains the monthname, you can use this DAX statement:

Month Name = FORMAT('<tablename>'[Monthdate] , "MMM")

Make sure that this column is sorted by an extra column that just contain the month number, you can create this calculated column by using this DAX:

Month Number = MONTH('<tablename>'[MonthDate])

After creating all the columns it's necessary to arrange the year and month name column for the visual like so:

image.png

 

Make both colummns are expanded:

image.png

Disable the property "Concatenate labels" from the X Axis band of the visual:

image.png

 

Make sure the X Axis is sorted accordingly:

image.png

 

You may also have to change the sort order to "Ascending".

 

Hopefully this provides you with some ideas.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

Hey,

 

you have to use a column for the x-axis that also contains the year.

 

You can create a Calculated Column using the DAX statement: 

 

Year-Month = FORMAT('<tablename>'[MonthDate] , "YYYY-MM")

This will create something like this "2018-09" and will represent September 2018. You might want to create two columns one containning the year and one containing the month name (please be aware that the month name has to be sorted by a month number: https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column#sort-using-the-sort-by-column-butto...)

To create a chart like this:


image.png

 

it's necessary to create two additional columns that contain the year and the month. To create a calculated column that contains the monthname, you can use this DAX statement:

Month Name = FORMAT('<tablename>'[Monthdate] , "MMM")

Make sure that this column is sorted by an extra column that just contain the month number, you can create this calculated column by using this DAX:

Month Number = MONTH('<tablename>'[MonthDate])

After creating all the columns it's necessary to arrange the year and month name column for the visual like so:

image.png

 

Make both colummns are expanded:

image.png

Disable the property "Concatenate labels" from the X Axis band of the visual:

image.png

 

Make sure the X Axis is sorted accordingly:

image.png

 

You may also have to change the sort order to "Ascending".

 

Hopefully this provides you with some ideas.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

That's perfect! Thank you ever so much.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors