Duration.Days
DurationReturns the whole days component from a duration value.
Syntax
Duration.Days(duration as nullable duration) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
duration | duration | Yes | The duration value to extract the days component from. |
Return Value
number — The whole number of days in the duration.
Remarks
Duration.Days returns the whole number of days from a duration value. This is the day component only, not the total days as a decimal. For the total elapsed days including fractions, use Duration.TotalDays. If the input is null, the function returns null.
Examples
Example 1: Extract days from OrderLog durations
Table.AddColumn(
Table.SelectColumns(
Table.SelectRows(
OrderLog,
each [DurationMinutes] <> null
),
{"LogID", "DurationMinutes"}
),
"Days",
each Duration.Days(#duration(0, 0, [DurationMinutes], 0)),
Int64.Type
)Result
LogID | DurationMinutes | Days | |
|---|---|---|---|
| 1 | L002 | 1,725 | 1 |
| 2 | L004 | 2,745 | 1 |
| 3 | L006 | 1,065 | 0 |
| 4 | L008 | 2,670 | 1 |
Example 2: Extract days from a scalar duration
#table(
type table [Duration = duration, Days = number],
{{#duration(3, 5, 30, 0), Duration.Days(#duration(3, 5, 30, 0))}}
)Result
Duration | Days | |
|---|---|---|
| 1 | 3.05:30:00 | 3 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks