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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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! 

Anonymous
Not applicable

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

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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors