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
Brazen_BI
Regular Visitor

Convert Text (x Hours, xMinutes, xSeconds) to duration

Attempted unsuccessfully to convert text from column labeled "Handled Duration" into duration type with format "00:00:00". Purpose is to eventually use this column to calcuate total and average handle time durations. Have tried simply changing format (which returns expressions:error:we couldn't parse the Duration literal). I'm aware of the duration.fromtext function, though every iteration i've tried has failed. Can someone please assist?

duration.PNG

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Hi, @Brazen_BI 

 

=Time.From(
Text.Combine(
List.Transform(
Text.Split([Handled Duration],", "),
each Text.BeforeDelimiter(_," ")),
":")
)

or

#time(
Number.From(Text.BeforeDelimiter([Handled Duration]," Hours")),
Number.From(Text.BetweenDelimiters([Handled Duration],"Hours, "," Min")),
Number.From(Text.BetweenDelimiters([Handled Duration],"Minutes, "," Sec")))

 

Stéphane 

View solution in original post

2 REPLIES 2
slorin
Super User
Super User

Hi, @Brazen_BI 

 

=Time.From(
Text.Combine(
List.Transform(
Text.Split([Handled Duration],", "),
each Text.BeforeDelimiter(_," ")),
":")
)

or

#time(
Number.From(Text.BeforeDelimiter([Handled Duration]," Hours")),
Number.From(Text.BetweenDelimiters([Handled Duration],"Hours, "," Min")),
Number.From(Text.BetweenDelimiters([Handled Duration],"Minutes, "," Sec")))

 

Stéphane 

Thanks. I combined this solution with a measure to calculate average duration time to get the final visual I needed: 

Average Handle Time Duration = FORMAT(AVERAGE('Table'[Column]),"HH:MM: SS")

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors