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
Datagulf
Responsive Resident
Responsive Resident

Sort a Month Year Column

I am trying to sort a column called MOnth Year Num. How can I create a column to sort it?

Datagulf_0-1674558350236.png


I have a Bar chart that shows the last 3 months. So I want to sort that column so that October 2022 comes fast. 

Datagulf_0-1674559644606.png

 

 

 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

One of ways to create a sort column for the Month Year Num column is to create a ENDOFMONTH column by using a DATE column and EOMONTH DAX formula.

 

EOMONTH function (DAX) - DAX | Microsoft Learn

 

I hope this helps.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

Anonymous
Not applicable

Month and Year = FORMAT([Date], "YYYY") & MONTH('Calendar'[Date])
 
try this, let me know if it works 🙂 

View solution in original post

11 REPLIES 11
LP280388
Resolver II
Resolver II

@Datagulf,
you can create a Date_start column as below. 

LP280388_0-1674563143857.png

then create a copy of the "month year num" column and use the Date_start column to sort.  We create the copy of the column to ensure that you wont get the circular dependancy error.

LP280388_1-1674563227353.png

then use the newly created copy of the column in your chart as below.

LP280388_2-1674563317629.png

 

 

Anonymous
Not applicable

Can we get more info on how you're trying to sort it? I can see you've made a sort column.

ADPowerBI1_0-1674558997757.png

 

Can you select the sort column from here?

Thanks, I am looking for sth different, which is to sort a  Month Year Num. Your Solutions is for a fiscal year. 
I have a Bar chart that shows the last 3 months. So I want to sort that column so that October 2022 comes fast

Datagulf_0-1674559499266.png

 



Anonymous
Not applicable

Create a Month number + Year column

Year('Date') & Month(date).

 

Put this column in the Tooltip part of your visual

ADPowerBI1_0-1674559741522.png

Then in the top right of your visual, sort by that column

ADPowerBI1_1-1674559775673.png

Hope this helps!

 

It has ordered but not correctly...
2023 Jan comes at the right position but  2022 months are not ordered...

Datagulf_0-1674561434667.png

 

Anonymous
Not applicable

Can you show me your calculated Column code for the sort please? 🙂 

Month and Year = FORMAT([Date], "YYYY") & FORMAT('Calendar'[Date],"mmmm")
Anonymous
Not applicable

Month and Year = FORMAT([Date], "YYYY") & MONTH('Calendar'[Date])
 
try this, let me know if it works 🙂 
Anonymous
Not applicable

or try YEAR('Calendar'[Date] & MONTH('Calendar'[Date])

 

this is how i would write it 🙂 

Jihwan_Kim
Super User
Super User

Hi,

One of ways to create a sort column for the Month Year Num column is to create a ENDOFMONTH column by using a DATE column and EOMONTH DAX formula.

 

EOMONTH function (DAX) - DAX | Microsoft Learn

 

I hope this helps.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Please expound, I did not understand your solution..

 

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.