Duration.TotalHours
A duration's whole length counted in hours, fractions included.
Group: Dates and times. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Duration.TotalHours(duration as nullable duration) as nullable number
| Parameter | Type | Description |
|---|---|---|
duration | nullable duration | The duration; null gives null. |
Returns
nullable number. The length in hours, with a fraction for minutes and seconds.
Remarks
- The usual way to turn worked time or lead time into a number for a measure.
Examples
A shift of 8 hours 30 minutes
Duration.TotalHours(#duration(0, 8, 30, 0))
8.5
A delivery time
Duration.TotalHours(#datetime(2024, 3, 18, 10, 0, 0) - #datetime(2024, 3, 15, 14, 30, 0))
67.5
From 15 March 14:30 to 18 March 10:00 is 2 days, 19 hours and 30 minutes.