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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mrbrabrook22
New Member

How to convert text to duration without Error

Hi! I am attempting to display the sum of the duration passed (so the sum of this column) for various filters, and right now the field is reading as text in PowerBI.  The duration is written as days hours:minutes:seconds, is there anyway to convert to duration without getting an error and sum up the column. Additionally, there is an event stamp column I can use with the date and time the alarm started.

Screenshot 2023-07-14 083953.png

1 REPLY 1
Vijay_A_Verma
Super User
Super User

If you want to convert in a custom column

 

Duration.FromText(Text.Replace([UnAckDuration]," ","."))

 

If you want to sum the column and use it somewhere in your code (Replace Source with your previous step of the code)

 

List.Sum(List.Transform(Source[UnAckDuration], (x)=>Duration.FromText(Text.Replace(x," ","."))))

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors