Duration.TotalDays
DurationReturns the total number of days represented by a duration value.
Syntax
Duration.TotalDays(duration as nullable duration) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
duration | duration | Yes | The duration value to convert to total days. |
Return Value
number — The total number of days as a decimal.
Remarks
Duration.TotalDays returns the total elapsed time of a duration value expressed as a decimal number of days. Unlike Duration.Days, which returns only the whole day component, Duration.TotalDays includes fractional days. If the input is null, the function returns null.
Examples
Example 1: Convert DurationMinutes to total days
Table.AddColumn(
Table.SelectColumns(
Table.SelectRows(
OrderLog,
each [DurationMinutes] <> null
),
{"LogID", "DurationMinutes"}
),
"TotalDays",
each Duration.TotalDays(#duration(0, 0, [DurationMinutes], 0)),
type number
)Result
LogID | DurationMinutes | TotalDays | |
|---|---|---|---|
| 1 | L002 | 1,725 | 1.20 |
| 2 | L004 | 2,745 | 1.91 |
| 3 | L006 | 1,065 | 0.74 |
| 4 | L008 | 2,670 | 1.85 |
Example 2: Total days from a scalar duration
#table(
type table [Duration = duration, TotalDays = number],
{{#duration(2, 12, 0, 0), Duration.TotalDays(#duration(2, 12, 0, 0))}}
)Result
Duration | TotalDays | |
|---|---|---|
| 1 | 2.12:00:00 | 2.50 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks