cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shankarshiva70
Helper III
Helper III

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
TarunSharma
Skilled Sharer
Skilled Sharer

Hello @shankarshiva70 ,
Create MonthYearInteger column 
MonthYearInteger = 

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

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

Hi Tarun, 

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

Fowmy
Super User
Super User

@shankarshiva70 


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

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
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

Power BI Dev Camp Session 25 with aka link 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, August 25 at 11a PDT for a great session with Ted Pattison!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors