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

Sorting the Month year column

Hi

 

I have the below table

 

jason2000_0-1626995164246.png

I don't have the separate date column as this data is very small. My data is based on the calendar year. I sort the month year based on month number and visualize the month year vs value, getting below graph

 

jason2000_1-1626995271671.png

jason2000_2-1626995306906.png

My axis (mont year) is not sorting. I have the data from June 2021 - April 2022. This is monthly data. My data source is excel, and next month we change the data and it becomes July 20222 - April 2022. 

 

I need to sort this month's year in the graph (June 2021 - April 2022) and also ensure it sorts automatically if the date is updated.

 

Could you please advise?

 

 

 

1 ACCEPTED SOLUTION
ebeery
Memorable Member
Memorable Member

@Anonymous you need to set the "sort by" column for your Month-Year column to "MonthNumber".

From Data view, select the "Month-Year" column and set the "Sort By" column to "MonthNumber".

EDIT - you may also want to create a column in the format YYYYMM which combines year and monthnumber, and sort by this column instead.  That will enable proper sorting across calendar years.

Below is an example with a similar dataset.

ebeery_0-1626995702028.png

 




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

The marked solution does not work.

 

you need to use the following method, by multiplying the Year by 100 + number of month..

here is a video on it:

https://www.youtube.com/watch?v=Oq5WOmo94_Q&ab_channel=BILand

ebeery
Memorable Member
Memorable Member

@Anonymous you need to set the "sort by" column for your Month-Year column to "MonthNumber".

From Data view, select the "Month-Year" column and set the "Sort By" column to "MonthNumber".

EDIT - you may also want to create a column in the format YYYYMM which combines year and monthnumber, and sort by this column instead.  That will enable proper sorting across calendar years.

Below is an example with a similar dataset.

ebeery_0-1626995702028.png

 




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.