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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
dustdaniel
Helper II
Helper II

Sorting string date dd-mmm in line chart

Hi Everyone,

 

Could you guide me on what is the correct function to sort properly this string date dd-mmm in my line chart

 

dustdaniel_0-1726864048145.png

The date goes like this:

Calendar date dd-MMM = FORMAT(DateTable2[Date], "dd-MMM")

And the sort colum goes like this:

Sort dd-mmm = DAY(DateTable2[Date]) & MONTH(DateTable2[Date])

 

My result is obviously not correct:

dustdaniel_1-1726864250819.png

 

1 ACCEPTED SOLUTION
marcelsmaglhaes
Super User
Super User

Hey @dustdaniel 

Keep the dd-MMM format for display, and then create a proper sorting column using the numeric value of the month and day like this:

SortColumn = MONTH(DateTable2[Date]) * 100 + DAY(DateTable2[Date])

This ensures that January 1st (0101) comes before February 1st (0201), and so on.

Don't forget to set the Sort by column in your data model to sort Calendar date dd-MMM by SortColumn.


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



View solution in original post

4 REPLIES 4
marcelsmaglhaes
Super User
Super User

Hey @dustdaniel 

Keep the dd-MMM format for display, and then create a proper sorting column using the numeric value of the month and day like this:

SortColumn = MONTH(DateTable2[Date]) * 100 + DAY(DateTable2[Date])

This ensures that January 1st (0101) comes before February 1st (0201), and so on.

Don't forget to set the Sort by column in your data model to sort Calendar date dd-MMM by SortColumn.


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Thank you very much Marcel,

 

It's working propperly. I have an additional question. 

 

When I have a Line chart with only one continuous line, it is available the option X-axis / Type: contonuous but this is not available then there are multiple lines. Is there a tourn around for that?

dustdaniel_0-1726866627655.png

 

Ensure that your x-axis data is numerical or date/time...

marcelsmaglhaes_0-1726867092155.png

 


Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI

If I've helped, don't forget to mark my post as a solution!



Thanks. That makes sence!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.