March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I am trying to convert a column type string to duration and tried doing my own research to do it, but I have failed.
This is the column I am needing to convert.
This is the M code I am using.
= Table.TransformColumns(#"Changed Type",{"Resolution Time (in Hrs)",each
let txt=_,
h=Number.From( Text.Start(txt,2)),
mm=Number.From( Text.Middle(txt,3,2)),
ss=Number.From( Text.End(txt,2)),
dd=Number.IntegerDivide(h,24),
hh=Number.Mod(h,24)
in
#duration(dd,hh,mm,ss),
type duration
}
)
Here are the results
I believe I am getting the errors because of the 3 digit hours, but I do not understand or know how to do a range for the start.text or if that is even how I should approach this.
Please help!
You can use Text.BeforeDelimiter, .AfterDeli... , .BetweenDelim... for this.
--
A slightly easier way might be to Split the column on ":" and then add a custom column to construct the desired result , for example, #duration(0,1stCol, 2ndCol, 3rdCol)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
127 | |
84 | |
59 | |
59 | |
44 |
User | Count |
---|---|
180 | |
119 | |
82 | |
70 | |
54 |