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

Problem with X Asix Sorting Month and Year

Hey guys, i have the following problem:

 

I have a dataset with a date column with values beginning from 2021-9 to today (formatted as date).

Now when i create a visual with the date on the x - Axis it gets sorted like that

 

Jan - September - Oktober-November December

 

But what i need is:

 

September - Oktober - November - December - January Because (its 2022)

I tried it with Concatenate and formatting it as a whole number and then sort it by that doesnt work.

 

Any suggestions?

 

EngineerFabi_0-1643370486498.png

Thanks in advance. I did not find a solution that work for me via the search function.

 

BR

1 ACCEPTED SOLUTION
v-yetao1-msft
Community Support
Community Support

Hi @Anonymous 

Change the format of your date to (yyyy-mm) and add the date in column chart as a hierarchy .

Ailsamsft_0-1643870908789.png

Ailsamsft_1-1643870908790.png

The final result is as shown :

Ailsamsft_2-1643870908792.png

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-yetao1-msft
Community Support
Community Support

Hi @Anonymous 

Change the format of your date to (yyyy-mm) and add the date in column chart as a hierarchy .

Ailsamsft_0-1643870908789.png

Ailsamsft_1-1643870908790.png

The final result is as shown :

Ailsamsft_2-1643870908792.png

Best Regard

Community Support Team _ Ailsa Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi ValtteriN,

 

thanks for your advise. It definetly helped me but now my x axis looks like this:

 

EngineerFabi_0-1643373424844.png

If i sort the X-Axis it doesnt help at all.

 

Any suggestions?

Anonymous
Not applicable

the column seems to be in a text format. When i change it to date it sometimes messes up the year and tooks for every row 2022.

Hi,

You can add additonal column with number type data and use that to sort your axis. e.g.

sort = CONCATENATE(YEAR('Calendar'[Date]),MONTH('Calendar'[Date]))

ValtteriN_0-1643374367110.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Ok ty! this worked, but now i have on the X-Axis the Sort Value like this:

EngineerFabi_0-1643375252294.png

But for the Dashboard viewers it would be better to have the CustomColumn on the X-Axis. But how can i define X=CustomColumn but sort it with the Sort column?

 

BTW. The mistake i did was that there was the zero missing for january "01" so i wasnt sorted correctly before by number

 

ValtteriN
Super User
Super User

Hi,

For these type of visualizations I highly suggest using a format that display year and month at the same time. Here is one way to do this in a calendar table: 

CustomFormat = FORMAT(DATE(YEAR('Calendar'[Date]),MONTH('Calendar'[Date]),1),"MMM-YY")

After you have this kind of column you can sort it e.g. using a column with data like this 2021,12
This will solve your sorting issue and it will make the visualization more readable.

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.