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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
MarLinCH
Regular Visitor

Formatting Text to Duration

Hi everyone, 

 

First time here, so I'm excited to get help - thank you very much. 

MarLinCH_0-1696256350295.png

I receive a weekly update with data, including the time for certain calls. "Non ACD Calls in Time" and "Logged On Time (Per Skill Group)" are being seen as "Text," while "Non ACD Calls Out Time" is being seen as "Time." I would like to format all columns as "Time" to see how many hours, minutes, and seconds people spend on the phone. 

 

In the raw data set, everything is formatted as the same: 

MarLinCH_1-1696256587227.png

Thank you very much for your help!

Cheers

Markus

1 ACCEPTED SOLUTION

Thank you very much - I've also found sth. that worked: 

let
    DurationFromYourText = (text as text) as duration => let
        Split = Text.Split(text, ":"),
        AsNumbers = List.Transform(Split, Number.FromText),
        Duration = #duration(0, AsNumbers{0}, AsNumbers{1}, AsNumbers{2})
    in
        Duration,
    Invoked = DurationFromYourText([#"Logged On Time (Per Skill Group)"])
in
    Invoked

View solution in original post

5 REPLIES 5
mlsx4
Super User
Super User

Hi @MarLinCH 

 

Have you tried to change data type from here? You select the column and change to duration

mlsx4_0-1696257629260.png

 

Yes, if I change it to "Duration", it will show "Error":

MarLinCH_0-1696337165635.png

 

Hi @MarLinCH 

Ok, I think the problem is because you have duration over 24 hours. Try to apply this solution: https://community.fabric.microsoft.com/t5/Desktop/Duration-Error-over-24-00-00/td-p/1204481

Thank you very much - I've also found sth. that worked: 

let
    DurationFromYourText = (text as text) as duration => let
        Split = Text.Split(text, ":"),
        AsNumbers = List.Transform(Split, Number.FromText),
        Duration = #duration(0, AsNumbers{0}, AsNumbers{1}, AsNumbers{2})
    in
        Duration,
    Invoked = DurationFromYourText([#"Logged On Time (Per Skill Group)"])
in
    Invoked

@MarLinCH 

That's nice!! Please, mark the topic as solved for other users who may have the same problem

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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