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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
AleksP
Frequent Visitor

Duration conversation 00:60:54 to 01:00:54

Hi All, 

 

I have the following issue. 

Data source does not convert to hours when time is in 60min like this example:
00:60:54 - which is 60mins and 54sec .. and when I chagne type = Duration I got an error. 

AleksP_0-1690358895541.png

Any ideas how to convert 0:60:** to 1:00:** ? It should be 1:00:54

Same happens when I have 60 seconds but I have deal with using replace values "00:00:60" = "00:01:00" 

If the minutes are above 60 data source is counting as 1 hour but if is in 60min ... 😕

 

1 ACCEPTED SOLUTION
slorin
Super User
Super User

In your first message :  "Duration conversation 00:60:54 to 01:00:54"

but you have just one 0 : "0:28:07"

 

Duration.From(
(
Number.From(Text.Start([Column1],1))*3600
+Number.From(Text.Middle([Column1],2,2))*60
+Number.From(Text.End([Column1],2))
)
/86400)

 or

Duration.From(
(
Number.From(Text.BeforeDelimiter([Column1], ":"))*3600
+Number.From(Text.BetweenDelimiters([Column1], ":", ":"))*60
+Number.From(Text.AfterDelimiter([Column1], ":", 1))
)
/86400)

 Stéphane 

View solution in original post

5 REPLIES 5
AleksP
Frequent Visitor

Thank you ALL !!! 

Duration.From(
(
Number.From(Text.BeforeDelimiter([Column1], ":"))*3600
+Number.From(Text.BetweenDelimiters([Column1], ":", ":"))*60
+Number.From(Text.AfterDelimiter([Column1], ":", 1))
)
/86400)

That one worked flawlessly :)) Have a good day ahead. Thank you! 

watkinnc
Super User
Super User

It's because you have "0:" in there somewhere. Try replacing those Text.Start, .Middle, and .End with Text.BeforeDelimiter, .Between Delimiters, and .AfterDelimiter, using the ":" as the delimiters for each parameter (add 1 for the optional Index parameter in Text.AfterDelimiter though!).

Make that replacement in @slorin 's formula and it will work.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
slorin
Super User
Super User

In your first message :  "Duration conversation 00:60:54 to 01:00:54"

but you have just one 0 : "0:28:07"

 

Duration.From(
(
Number.From(Text.Start([Column1],1))*3600
+Number.From(Text.Middle([Column1],2,2))*60
+Number.From(Text.End([Column1],2))
)
/86400)

 or

Duration.From(
(
Number.From(Text.BeforeDelimiter([Column1], ":"))*3600
+Number.From(Text.BetweenDelimiters([Column1], ":", ":"))*60
+Number.From(Text.AfterDelimiter([Column1], ":", 1))
)
/86400)

 Stéphane 

slorin
Super User
Super User

Hi

 

Duration.From(
(
Number.From(Text.Start([Column1],2))*3600
+Number.From(Text.Middle([Column1],3,2))*60
+Number.From(Text.End([Column1],2))
)
/86400)

 

Stéphane

AleksP
Frequent Visitor

Many thanks for quick reply but maybe I have to change the format before adding this custom column? 

Below is before change type to Duration

AleksP_0-1690361609189.png
AleksP_1-1690361634661.png

And here is after change type to Duration

AleksP_2-1690361775182.png

AleksP_3-1690361790112.png

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors