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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

How to Sort the Axis in a Chart which is having Month name.

How to Sort the Axis in a Chart which is having Month and Year (MMM-YY) and uses data from Power BI dataset live connect.
1. I have one date column, with that date column create one calculated column with format(mm-yyyy).

Anjaneyachari_0-1688533119212.png

 

 

2 REPLIES 2
Dhairya
Super User
Super User

Hey @Anonymous 
to sort your month-year column you have to add a new column with below mentioned DAX.

 

Sort month year = FORMAT(YourTable[DateColumn], "yyyymm")

Now in data view click on the month-year column which you have plotted on the x-axis and sort it with our newly created above column and you will get the expected result

Dhairya_0-1688536837604.png

 

Dhairya_2-1688537142056.png

 


If this helps you please mark my solution as accepted so that other users can find this quickly when they face similar issue. Thank You!

TomMartens
Super User
Super User

Hey @Anonymous ,

 

by default the values in a slicer or on an axis are sorted by name, this means April first instead of January. For this reason you have to create an extra column that contains a sort index.
Based on a date column you can use this DAX to create a numeric value that can be used for the ordering:

YearMOnthSort = YEAR( 'tablename'[datecolumn] ) * 100 + Month ( 'tablename'[datecolumn] )

 

This article describes how to sort one column by a 2nd column: https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column?tabs=powerbi-desktop

Hopefully, this provides what you are looking for.

 

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

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.