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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Dates stopped sorting in order

Hello,

 

Today, when working on report everything is going well.

Suddenly things stopped work well:
My date charts got crazy, they stopped to show up in order.

(styczeń- january, listopad- november, grudzień- december)

TomaszB_0-1610101732643.png

I did open another powerBi file, everything going well there. 

TomaszB_1-1610101934435.png

It is happening with every chart that I am creating in this file.

1 ACCEPTED SOLUTION

I've only ever modified my Calendar table in power query, but I'll give it a try by editing BA_Pete's answer for a dax calculated column:

 

yearMonth = FORMAT([date], "yy") & "-" & FORMAT([date], "MM")

 

View solution in original post

15 REPLIES 15
Anonymous
Not applicable

I know why this had happened.

 

Until 2020, everything was in order.

PowerBi is connected with excel file, where requests from google forrms are submitted

 

Yesterday new request came in from from 07.01.2021, and now powerBi takes this January and put it before November, ignoring that year has changed.

Do you know how can I put the fresh dates first?
It is happening with every chart type

Hi @Anonymous ,

 

If you want January 2021 to show after (further right on axis than) November and December 2020 you will need to give the chart visuals some concept of year. It appears as though you are currently using only Month on your axis, in which case they are being sorted correctly - January is indeed before November and December.

I would recommend creating a new column, either in your data source or in a calendar table (best practice), for Month/Year and using this on your axes. This will allow your chart to understand that Jan 2021 comes after Nov/Dec 2020.

Assuming the dates in your data source are complete dates, i.e. a day, a month, and a year component, then you can create your new column as follows:

 

DAX

 

monthYear = FORMAT([date], "MMM") & " " & FORMAT([date], "yy")

 

 

Power Query M

 

monthYear = Text.Combine({Text.Start(Date.MonthName([date]), 3), Text.End(Text.From(Date.Year([date])),2)}, " ")

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Did it

TomaszB_1-1610356634548.png

 

TomaszB_0-1610356605073.png

Same thing on visual:

TomaszB_2-1610356724031.png

TomaszB_3-1610356748536.png

 

Chart remains the same 😕

When I create a column for month names, I include the year too, whenever the date in question is not in the current year. Ie. december of last year would display as "Dec 2020" and january from this year would be just "Jan".

 

I'd create a separate sorting column for the months that always include year and month as numbers. Then choose your actual month parameter and go to Column tools >Sort by Columns > choose the sorting column.

Anonymous
Not applicable

Gabriel, what DAX formula to use in order co create sorting columns with month and years as numbers?

Jan 2020 is 1
Feb 2020 is 2 and so on

 

I read some article in which you have to create new table, but can we do it without new table?

 

I've only ever modified my Calendar table in power query, but I'll give it a try by editing BA_Pete's answer for a dax calculated column:

 

yearMonth = FORMAT([date], "yy") & "-" & FORMAT([date], "MM")

 

Anonymous
Not applicable

TomaszB_0-1610362024044.png

 

Wow, after resfreshing it seems like things are working correctly.

 

Big thanks Gabriel_Walkman for the answer!

 

BA_Pete- thanks for your contribution ❤️

Hi @Anonymous ,

 

Very glad to hear it's working for you, but disappointed that you didn't accept my answer as the solution. Could you let me know what the answer that you accepted gave you that mine didn't please? I think the solution provider even mentioned the fact that they had just used my answer to provide theirs.

 

BA_Pete_0-1610374735953.png

 

Thanks in anticipation,

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

I couldn't mark your answer as a solution because this configuration "mmm" "yy" did not work (like on attached screenshots)

Gabriel only modified it to "yy" "mm" so all is numeric- then it starts working. 


I could experiment with transforming code by myself and mark your answer as a solution, but Gabriel modified your answer and gave me everything ready.

Next time gonna be more carefull about it.

Hi @Anonymous ,

 

Thanks for getting back to me, I appreciate you taking the time to explain.

 

I see what the issue was: you wanted to use the [yearMonth] column as a sort column for your [Month] column so you could use [Month] in the axis, in which case Gabriel's numerical version was indeed correct. In my answer, I expected you to use the [yearMonth] column as the axis, not as a sort column.

 

I'll pay more attention going forward 🙂

 

Pete

 

 



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Silly question, I'm sure, but have you checked that your chart sorting hasn't been reset to default somehow?

BA_Pete_0-1610103475628.png

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Thanks for your answer!

 

Yes, I have been trying to do so, trying to google this for an trying different things and options.

Still not right.

 

TomaszB_0-1610105193691.png

 For days, it is working well:

TomaszB_1-1610105821154.png

Btw. month are formatted as date as well as days.

 

Gabriel_Walkman
Continued Contributor
Continued Contributor

Create an index for the months if it doesn't exist already, then choose your month parameter and go to Column tools >Sort by Columns > choose the index.

 

Or is there something else wrong with the charts too?

Anonymous
Not applicable

Thanks for your answer!

 

In a table, everything looks well, I can sort easily by date.

Funny thing is, that for days it works fine, like here

TomaszB_1-1610105821154.png

 

Anonymous
Not applicable

I did try this, seems like it doesnt work as well.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors