Duration.Days

Duration

Returns the whole days component from a duration value.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Duration.Days(duration as nullable duration) as nullable number

Parameters

NameTypeRequiredDescription
durationdurationYesThe duration value to extract the days component from.

Return Value

numberThe 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
1L0021,7251
2L0042,7451
3L0061,0650
4L0082,6701

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
13.05:30:003

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks