Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Sort time interval in chronological order

Hi, I am trying to sort some time intervals in a slicer. They each represent a week, yet they are in a very strange order. I think PBI interprets them as text instead of time interval, so each number is sorted like characters.

 

I want to sort them in chronological order. I think based on the first date should be good enough. May I ask how I can do that? Thank you!

 

 

  • Hi Anonymous ,

    I used some of your values (not all) and tried to simulate your issue. I think I came to a solution.

    From this slicer here....

     

    ...I was able to sort them and ended up with this:

     

    I first created a new column in power query where I parsed all the values before the delimeter "-" of the interval column, ending up with the dates in text format. I then changed the type of the new column to date. Finally, I used the "sort by" function to order the intervals by the new column as seen in the link of the previous answer.

     

    Hope this helps!


    /Tom

    https://www.tackytech.blog

    https://www.instagram.com/tackytechtom

2 Replies

  • tackytechtom's avatar
    tackytechtom
    Most Valuable Professional

    Hi Anonymous ,

    I used some of your values (not all) and tried to simulate your issue. I think I came to a solution.

    From this slicer here....

     

    ...I was able to sort them and ended up with this:

     

    I first created a new column in power query where I parsed all the values before the delimeter "-" of the interval column, ending up with the dates in text format. I then changed the type of the new column to date. Finally, I used the "sort by" function to order the intervals by the new column as seen in the link of the previous answer.

     

    Hope this helps!


    /Tom

    https://www.tackytech.blog

    https://www.instagram.com/tackytechtom