Forum Discussion

Pjay987's avatar
Pjay987
Frequent Visitor
5 years ago
Solved

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

    • Pjay987's avatar
      Pjay987
      Frequent 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's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft 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

    • Pjay987's avatar
      Pjay987
      Frequent Visitor

      Thanks Pat! That worked. Thank you so much for your help/\.