Duration.Seconds
DurationReturns the seconds component from a duration value.
Syntax
Duration.Seconds(duration as nullable duration) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
duration | duration | Yes | The duration value to extract the seconds component from. |
Return Value
number — The 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 | |
|---|---|---|---|
| 1 | L002 | 1,725 | 0 |
| 2 | L004 | 2,745 | 0 |
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 | |
|---|---|---|
| 1 | 1.08:25:42 | 42 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks