Duration.Seconds

Duration

Returns the seconds 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.Seconds(duration as nullable duration) as nullable number

Parameters

NameTypeRequiredDescription
durationdurationYesThe duration value to extract the seconds component from.

Return Value

numberThe seconds component (0 through 59).

Remarks

Duration.Seconds returns the seconds component (0 through 59) from a duration value. This is the seconds portion after removing whole days, hours, and minutes. If the input is null, the function returns null.

Examples

Example 1: Extract seconds from OrderLog durations

Table.AddColumn(
    Table.SelectColumns(
        Table.SelectRows(
            Table.FirstN(OrderLog, 4),
            each [DurationMinutes] <> null
        ),
        {"LogID", "DurationMinutes"}
    ),
    "Seconds",
    each Duration.Seconds(#duration(0, 0, [DurationMinutes], 0)),
    Int64.Type
)
Result
LogID
DurationMinutes
Seconds
1L0021,7250
2L0042,7450

Example 2: Extract seconds from a scalar duration

#table(
    type table [Duration = duration, Seconds = number],
    {{#duration(1, 8, 25, 42), Duration.Seconds(#duration(1, 8, 25, 42))}}
)
Result
Duration
Seconds
11.08:25:4242

Compatibility

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