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
dylanndengu
Helper I
Helper I

Sort by Month AND Year

Hi Everyone,

 

I am having problems sorting out my date variable to fit my graph chronologically. 

To give you some context, our financial year runs from July 2020 to June 2021, and the data I have is currently from July 2020 up to end of January 2021. Now, for the past six months I've been creating dashboards which look like below:

 

dylanndengu_1-1614247287665.png

 

 

As you can see, the month is what is in the x-axis and is in chronological order from July to December up to 2020. However, now that I want to add January 2021 numbers, the graph comes out  below:

 

dylanndengu_2-1614247383276.png

 

As you can see, this is not a correct chronological order since the figures for January 2021 are ahead of the July-December 2020 numbers. Furthermore, if  try add "Year" to my current date hierachy, my graph looks like this:


dylanndengu_3-1614247537723.png

dylanndengu_4-1614247559962.png

 

I have seen other solutions stating that if you change the data type to "Date" it will sort chronoligically but this is not the case, as you can see. Hence, I am coming to ask for assistance in re-arranging my graph to be in the correct chronoligcal order of July to December 2020 followed by January 2021 and not have the January figures placed where they currently are.

 

I hope the context provided here is enough to gain your assistance.

 

 

1 ACCEPTED SOLUTION
dylanndengu
Helper I
Helper I

Hi, after further experimentation, I realised the solution was actually quite simple. On your graph, you can simply click those 3 dots at the top of your graph and then select "sort by", then select Month as shown below:

 

dylanndengu_1-1614322866457.png

 

As you can see, it is now in the order I wanted it to be. 

 

Thanks so much for your contributions everyone.

 

Kind regards,

Dylan

 

View solution in original post

4 REPLIES 4
dylanndengu
Helper I
Helper I

Hi, after further experimentation, I realised the solution was actually quite simple. On your graph, you can simply click those 3 dots at the top of your graph and then select "sort by", then select Month as shown below:

 

dylanndengu_1-1614322866457.png

 

As you can see, it is now in the order I wanted it to be. 

 

Thanks so much for your contributions everyone.

 

Kind regards,

Dylan

 

What if Month is not showing here 

 

krishanw_0-1671902448521.png

 

 

amitchandak
Super User
Super User

@dylanndengu , Create a month -year column  with sort column or month and year column with sort for month and use those

 

Month Year = FORMAT([Date],"mmm-yyyy")
Month Year sort = FORMAT([Date],"yyyymm")

 

Month Year = FORMAT([Date],"mmm")
Month Year sort = FORMAT([Date],"mm")

 

https://docs.microsoft.com/en-us/power-bi/desktop-sort-by-column

Hi @amitchandak , thank you for your response. However, I tried the method suggested and it has produced the following:

 

dylanndengu_0-1614249220154.png

 

Which is not necessarily correct. I would like it to go from July 2020 to January 2021 in chronological order.

 

Kind regards,

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.