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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors