Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
stoneluo
Regular Visitor

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!

stoneluo_1-1643654266988.png

 

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @stoneluo ,

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....

tomfox_0-1643664425612.png

 

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

tomfox_1-1643664614908.png

 

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



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
tackytechtom
Super User
Super User

Hi @stoneluo ,

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....

tomfox_0-1643664425612.png

 

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

tomfox_1-1643664614908.png

 

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



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

freginier
Solution Specialist
Solution Specialist

Hi you can't sort your column with another column. 

- First column (in your slicer) contain start and end of week

- Second column contain start of week and you sort on it

 

May help you 

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column

 

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.