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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SR1
Helper I
Helper I

Time sorting in text format

Hi,
I have a calculated column in Power BI report that represent time in the following format which is of text datatype.
Column1
4 hrs 20 mins
548 hrs 11 mins
2 hrs 04 mins
34 hrs 22 mins
60 hrs 40 mins
83 hrs 39 mins
I want to visualize it in a table visual in sorted order but sort by column doesn't work.

I want them in sorted order like this:
Column1
2 hrs 04 mins
4 hrs 20 mins
34 hrs 22 mins
60 hrs 40 mins
83 hrs 39 mins
548 hrs 11 mins

Is there any way I could sort this?

Thank you.

5 REPLIES 5
Greg_Deckler
Super User
Super User

Are you using a Sort By column where you convert these to:

 

260

32891

124

2062

3640

5019

 

?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

I am using sort by column in table visualization. And no the values are not getting converted.

This is the dax func I used to find the duration in hrs & mins.

Column =
INT(Query1[DurationInSecs]/ 3600) & " hrs " &
RIGHT("0" & INT((Query1[DurationInSecs] - INT(Query1[DurationInSecs] / 3600) * 3600) / 60), 2)& " mins"

 

 

@SR1,

Click on the column in your table, then sort it by DurationInSecs column. If you still get error message, please post the full error message.
1.PNG


Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuezhe-msft,

 

This is the error I am getting when I try to sort by DurationInSecs column.

Capture.JPG

Thanks,

SR

@SR1,

Could you please share complete data of your table? Regarding to the above error, please review my reply in this similar thread.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.