Duration.TotalSeconds
DurationReturns the total number of seconds represented by a duration value.
Syntax
Duration.TotalSeconds(duration as nullable duration) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
duration | duration | Yes | The duration value to convert to total seconds. |
Return Value
number — The total number of seconds as a number.
Remarks
Duration.TotalSeconds returns the total elapsed time of a duration value expressed as a number of seconds. Unlike Duration.Seconds, which returns only the seconds component (0 through 59), Duration.TotalSeconds converts the entire duration to seconds. If the input is null, the function returns null.
Examples
Example 1: Convert DurationMinutes to total seconds
Table.AddColumn(
Table.SelectColumns(
Table.SelectRows(
OrderLog,
each [DurationMinutes] <> null
),
{"LogID", "DurationMinutes"}
),
"TotalSeconds",
each Duration.TotalSeconds(#duration(0, 0, [DurationMinutes], 0)),
type number
)Result
LogID | DurationMinutes | TotalSeconds | |
|---|---|---|---|
| 1 | L002 | 1,725 | 103,500 |
| 2 | L004 | 2,745 | 164,700 |
| 3 | L006 | 1,065 | 63,900 |
| 4 | L008 | 2,670 | 160,200 |
Example 2: Total seconds from a scalar duration
#table(
type table [Duration = duration, TotalSeconds = number],
{{#duration(0, 2, 30, 15), Duration.TotalSeconds(#duration(0, 2, 30, 15))}}
)Result
Duration | TotalSeconds | |
|---|---|---|
| 1 | 0.02:30:15 | 9,015 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks