Forum Discussion

dustdaniel's avatar
dustdaniel
Helper II
1 year ago
Solved

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   The date goes like this: Calendar date dd-MMM = FORMAT(DateTa...
  • marcelsmaglhaes's avatar
    1 year ago

    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.