Forum Discussion
How to sort chart by 3 date columns?
- 11 months ago
Hi Jacek, the MonthName is of Text data type. By default, Power BI sorts text alphabetically (Apr, Aug...) so it's why we sort this column by a numeric column.
While Day and Year are both stored as Whole Number. Numbers naturally sort in ascending order (1, 2, 3… or 2023, 2024…), so Power BI doesn’t need a helper column.
Could you try first changing your Data Type for 'Day' and 'Year' Column from 'Text' to 'Number' under table view? then for the visual you either can add 'Date' to tooltip and sort axis by Date in Tooltip, or go back to Table view and sort by 'MonthName' column by 'MonthNum'. I think either way will give you correct date order on visual.
- jaryszek11 months agoSuper User
thanks.
I tried both methods and they worked.
Can you explain how this "go back to Table view and sort by 'MonthName' column by 'MonthNum'" is working ?
Why Days and Years accordingly adjusted?
Best,
Jacek- MasonMA11 months agoSuper User
Hi Jacek, the MonthName is of Text data type. By default, Power BI sorts text alphabetically (Apr, Aug...) so it's why we sort this column by a numeric column.
While Day and Year are both stored as Whole Number. Numbers naturally sort in ascending order (1, 2, 3… or 2023, 2024…), so Power BI doesn’t need a helper column.
- jaryszek11 months agoSuper User
thanks!