Duration.TotalMinutes
DurationReturns the total duration expressed as a fractional number of minutes.
Syntax
Duration.TotalMinutes(duration as nullable duration) as nullable numberParameters
| Name | Type | Required | Description |
|---|---|---|---|
duration | duration | Yes | A duration value. |
Return Value
number — The total number of minutes (including fractional parts) represented by the duration.
Remarks
Duration.TotalMinutes returns the entire duration as a decimal number of minutes. For example, 2 hours and 30 minutes returns 150.0. This differs from Duration.Minutes, which returns only the minutes component of the duration (e.g., 30 for the same input, not 150). Use Duration.TotalMinutes when you need elapsed time as a single numeric value for SLA analysis, billing calculations, or reporting. If the input is null, the function returns null.
A natural way to produce a duration for this function is to subtract two datetime values: Duration.TotalMinutes(endTime - startTime). The result is a decimal number, so 1 hour and 45.5 seconds returns 60.00833....
For other total-duration conversions, use Duration.TotalDays, Duration.TotalHours, or Duration.TotalSeconds. Use Duration.Minutes when you only need the minutes component (0–59) of a multi-day duration, not the cumulative total.
Examples
Example 1: Confirm total minutes match the source DurationMinutes column
Table.AddColumn(
Table.SelectColumns(
Table.SelectRows(OrderLog, each [DurationMinutes] <> null),
{"LogID", "DurationMinutes"}
),
"TotalMinutes",
each Duration.TotalMinutes(#duration(0, 0, [DurationMinutes], 0)),
type number
)LogID | DurationMinutes | TotalMinutes | |
|---|---|---|---|
| 1 | L002 | 1,725 | 1,725 |
| 2 | L004 | 2,745 | 2,745 |
| 3 | L006 | 1,065 | 1,065 |
| 4 | L008 | 2,670 | 2,670 |
Example 2: Total minutes for a mixed duration
#table(
type table [Duration = duration, TotalMinutes = number],
{{#duration(0, 2, 30, 0), Duration.TotalMinutes(#duration(0, 2, 30, 0))}}
)Duration | TotalMinutes | |
|---|---|---|
| 1 | 0.02:30:00 | 150 |
Example 3: Compute elapsed minutes between two datetime values
let
Created = #datetime(2024, 1, 15, 9, 30, 0),
Shipped = #datetime(2024, 1, 16, 14, 15, 0)
in
#table(
type table [Created = datetime, Shipped = datetime, ElapsedMinutes = number],
{{Created, Shipped, Duration.TotalMinutes(Shipped - Created)}}
)The final output — a one-row table showing the Created datetime, Shipped datetime, and the elapsed time between them expressed as total minutes.
Created | Shipped | ElapsedMinutes | |
|---|---|---|---|
| 1 | 1/15/2024 9:30:00 AM | 1/16/2024 2:15:00 PM | 1,725 |