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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to add index based on month and year combined- to sort month in asc order

Hello everyone,

I want to sort below month'Year in asending order. 

I am not able to sort. please help on this.

 

shankarshiva70_0-1610796941510.png

Used already-Created monthNo & sorted on and got result correct for only year but not for more than 1 year as it has more than 1 year like in above view .

I don't have to plot year above month row in view.

Thanks

Shiv

5 REPLIES 5
Anonymous
Not applicable

Hello @Anonymous ,
Create MonthYearInteger column 
MonthYearInteger = 

CONCATENATE( 'Calendar'[Year], RIGHT("0" & 'Calendar'[Month Number], 2) )
Sort the MonthYear column by MonthYearInteger.
Anonymous
Not applicable

Hi Tarun, 

 

Thanks for reply

I have done this by this way

Created one column 

MonthYearSort = FORMAT(Dates[Date],"YYYYMM")
Month'Year=Format(Dates[Dates],"MMM'YY")
then goto Sort by > click on monthyearsort then output will be correct.
Thanks
Then
Anonymous
Not applicable

Hi Tarun, 

I have done this using @amitchandak post. but thanks for reply you r also corect 

Fowmy
Super User
Super User

@Anonymous 


You need to create the sort column including the year, modify monthno column as follows, and sort by that:

YearMonth = YEAR(Dates[Date]) * 100 + MONTH(Dates[Date])

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Anonymous
Not applicable

Thanks for reply

I have done this by this way

Created one column 

MonthYearSort = FORMAT(Dates[Date],"YYYYMM")
Month'Year=Format(Dates[Dates],"MMM'YY")
then goto Sort by > click on monthyearsort then output will be correct.
Thanks
Then

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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