Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
Hello!
I am working on a dashboard to show staff's time accruals. The hour format is shown below. When I try to convert it to duration, it shows errors. The report comes in Hrs:Min:Sec. Please help!
The format for duration is Day.Hrs:Min:Sec where Day, Hrs,Min are integers, and Sec is a decimal.
Since Hrs is at or over 24 an error occurs, as that would be one day. Instead you will need to parse this manually using a function like:
(d as text) as duration =>
let
parts = List.Transform(Text.Split(d, ":"), Number.FromText),
asDuration = #duration(Number.IntegerDivide(parts{0}, 24), Number.Mod(parts{0}, 24), parts{1}, parts{2})
in
asDuration
Take a look at this problem, which may be the same as yours:
https://community.powerbi.com/t5/Power-Query/Duration-Conversion-and-Calculation/m-p/3132207#M100280
Basically, converting from a time or date won't work the way you want it to, so be sure that the data is not of that type.
Hope this helps -
Peter
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 6 | |
| 5 |