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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
Anonymous
Not applicable

Year Sort

I've made a calculated column for Month and year and It's showing as below:

 

Himanshu_13_0-1612967839374.png

The sorting is not correct it seems. I want the Month and Year to be sorted. 

 

Desired Output

 

DealMonth Year
xyzJan'2025
xyzFeb'2025
xyzJan'2026
xyzFeb'2026

 

How can I get the sorting right? Present I've sorted month year by Month.

 

Below are the formulas I've used:

 

Month Year = VIEW_FORECASTREVENUE[Month Name] & "'" & VIEW_FORECASTREVENUE[Year]
 
Month Name = SWITCH(VIEW_FORECASTREVENUE[Month],1,"Jan",2
,"Feb",3,"Mar",4,"April",5,"May",6,"June",7
,"July",8,"Aug",9,"Sep",10,"Oct"
,11,"Nov",12,"Dec")
 
Year = YEAR(VIEW_FORECASTREVENUE[EXPECTEDINMONTH])
 
Regards,
Himanshu
2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

Hi @Anonymous 

Create your column as actual dates and then they will sort properly.

Try this to create the column

Month Year = DATE(YEAR(VIEW_FORECASTREVENUE[EXPECTEDINMONTH]), VIEW_FORECASTREVENUE[Month], 1)

You should get a column of type DateTime that should sort chronologically

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

jaideepnema
Solution Sage
Solution Sage

Hi @Anonymous 
You can create a numeric key like 202101 for January 2021 and then use this column for sorting the Month-Year column using the sort by column option.

View solution in original post

7 REPLIES 7
harshnathani
Community Champion
Community Champion

HI @Anonymous ,

 

See if this helps

https://community.powerbi.com/t5/Desktop/how-to-sort-Date-MonthYear-column/td-p/102700

https://community.powerbi.com/t5/Desktop/Sorting-of-Month-Year/td-p/500324

 

Basically you need to create a Index Column and then sort your Month Year Column via the index colum created.

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

jaideepnema
Solution Sage
Solution Sage

Hi @Anonymous 
You can create a numeric key like 202101 for January 2021 and then use this column for sorting the Month-Year column using the sort by column option.

Anonymous
Not applicable

Thanks it solved my issue.

 

Regards,

Himanshu

PhilipTreacy
Super User
Super User

Hi @Anonymous 

Create your column as actual dates and then they will sort properly.

Try this to create the column

Month Year = DATE(YEAR(VIEW_FORECASTREVENUE[EXPECTEDINMONTH]), VIEW_FORECASTREVENUE[Month], 1)

You should get a column of type DateTime that should sort chronologically

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

Thank you !!!

 

It resolved my issue.

 

Regards,

Himanshu

Anonymous
Not applicable

Can you please show what actually you mean by "Actual dates". It is not clear to me.

 

Regards

@Anonymous 

Just added an example of how to create the dates based on your data.

Month Year = DATE(YEAR(VIEW_FORECASTREVENUE[EXPECTEDINMONTH]), VIEW_FORECASTREVENUE[Month], 1)

 

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors