Forum Discussion
Need Help Putting Dates in time order
Hello,
I have a set of data for employee hours by week. I want to see the dates in time order. Starting with Jan W1, Jan W2, Ect.
The issue I am having below is power BI is organizing the dates in alphabetical order. How do I fix this?
Thanks for your help!
You need to make a column in the query editor from that column to be used as the sort by column. A formula like this results in a Date value in the correct value. It isn't the date for each week (so you wouldn't want to use it in a visual), but it is the order you need. Repalce Column1 with your current column name.
= Date.FromText("2020-" & Text.BeforeDelimiter([Column1], " ") & Text.AfterDelimiter([Column1], "W"))
Regards,
Pat
4 Replies
- mahoneypat
Microsoft Employee
You need to set up a number monthweek column in the same table and set it as the Sort By Column for the one in the visual.
Sort by column in Power BI Desktop - Power BI | Microsoft Docs
Regards,
Pat
- Pjay987Frequent Visitor
Hello Pat,
Thanks for responding. It doesn't allow me to assign month weeks to these values since they are just text. Power BI isn't able to read them. Is there another solution you can think of?
- mahoneypat
Microsoft Employee
You need to make a column in the query editor from that column to be used as the sort by column. A formula like this results in a Date value in the correct value. It isn't the date for each week (so you wouldn't want to use it in a visual), but it is the order you need. Repalce Column1 with your current column name.
= Date.FromText("2020-" & Text.BeforeDelimiter([Column1], " ") & Text.AfterDelimiter([Column1], "W"))
Regards,
Pat
- Pjay987Frequent Visitor
Thanks Pat! That worked. Thank you so much for your help/\.