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

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
Resolver III
Resolver III

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 IV
Super User IV

@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!

Proud to be a Super User!

Website   YouTube    LinkedIn

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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors