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
telusive
Frequent Visitor

Formatting durations that come in as durations.

Hello! Currently I am connecting to SolarWinds, which is some sort of IT ticketing software. They have a to_resolve_business_time that is exactly that, the duration from the creation of the ticket to the resolution. This can be several hours. More than 24. Which is where I am encountering an issue. What do I do with this to format it as a duration so that I can use it for averaging etc? Anything over 24 hours is considered an Error. 

What can I provide to make this easier? 
It imports like this:

telusive_0-1735234110341.png
If it's text, I can't do any math as a duration, as I'd like to do average/median/etc. 

Thanks!

 

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@telusive,

 

Try this in Power Query:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjC0MjC1MjJVitUBcgysDEysjIzAHCMzKxDfQCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [to_resolve_business_time = _t]),
    ChangeType = Table.TransformColumnTypes(Source,{{"to_resolve_business_time", type text}}),
    Duration = each let d = List.Transform(Text.Split(_, ":"), Number.FromText) in #duration(0, d{0}, d{1}, d{2}),
    TransformColumn = Table.TransformColumns(ChangeType, {"to_resolve_business_time", Duration, type duration})
in
    TransformColumn

 

Raw data (text):

 

DataInsights_0-1735239567025.png

 

Result (duration):

 

DataInsights_1-1735239588148.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@telusive,

 

Try this in Power Query:

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjC0MjC1MjJVitUBcgysDEysjIzAHCMzKxDfQCk2FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [to_resolve_business_time = _t]),
    ChangeType = Table.TransformColumnTypes(Source,{{"to_resolve_business_time", type text}}),
    Duration = each let d = List.Transform(Text.Split(_, ":"), Number.FromText) in #duration(0, d{0}, d{1}, d{2}),
    TransformColumn = Table.TransformColumns(ChangeType, {"to_resolve_business_time", Duration, type duration})
in
    TransformColumn

 

Raw data (text):

 

DataInsights_0-1735239567025.png

 

Result (duration):

 

DataInsights_1-1735239588148.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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 Kudoed Authors