Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet 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
Hello,
I am trying to convert run_duration (DD: HH: MM: SS) column to Seconds.
For example, if Run duration is 1 Day: 1 hour: 1 minute: 1 second I need to convert it to 90061 seconds
86400 + 3600 + 60 + 1 = 90061.
Thanks
Solved! Go to Solution.
Seconds = VAR DurationString = SUBSTITUTE(Durations1[Duration], ":", "|") VAR Days = PATHITEM(DurationString,1) VAR Hours = PATHITEM(DurationString,2) VAR Minutes = PATHITEM(DurationString,3) VAR Seconds = PATHITEM(DurationString,4) RETURN Days * 86400 + Hours * 3600 + Minutes * 60 + Seconds
Seconds = VAR DurationString = SUBSTITUTE(Durations1[Duration], ":", "|") VAR Days = PATHITEM(DurationString,1) VAR Hours = PATHITEM(DurationString,2) VAR Minutes = PATHITEM(DurationString,3) VAR Seconds = PATHITEM(DurationString,4) RETURN Days * 86400 + Hours * 3600 + Minutes * 60 + Seconds
@smoupre wrote:
Seconds = VAR DurationString = SUBSTITUTE(Durations1[Duration], ":", "|") VAR Days = PATHITEM(DurationString,1) VAR Hours = PATHITEM(DurationString,2) VAR Minutes = PATHITEM(DurationString,3) VAR Seconds = PATHITEM(DurationString,4) RETURN Days * 86400 + Hours * 3600 + Minutes * 60 + Seconds
Wow, it is really tricky to use PATHITEM to get the substrings. Awesome work .
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.