List.Durations
ListGenerates a list of duration values starting from a given duration, with a specified count and step.
Syntax
List.Durations(start as duration, count as number, step as duration) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
start | duration | Yes | The starting duration value. |
count | number | Yes | The number of duration values to generate. |
step | duration | Yes | The duration increment to add between each successive value. |
Return Value
list — A list of duration values of length count, beginning at start and incrementing by step.
Remarks
List.Durations generates a sequence of duration values — each representing a span of time as days, hours, minutes, and seconds. The values are created using the #duration(days, hours, minutes, seconds) literal syntax.
This function is useful for building SLA threshold buckets, generating time interval labels, or producing elapsed-time checkpoints for scheduling analysis. Unlike calendar-based intervals (days, months), duration arithmetic is exact: there are no irregularities from leap years or variable month lengths.
A count of 0 returns an empty list; negative counts cause an error. The start value defines the first duration in the sequence; step defines the increment. Both can be zero (to start from zero duration) or negative (to generate decreasing durations). The resulting list can be transformed to text using Duration.ToText or manipulated with other duration functions like Duration.Hours and Duration.TotalHours.
Examples
Example 1: Generate hourly durations for 5 hours
List.Durations(#duration(0, 0, 0, 0), 5, #duration(0, 1, 0, 0))Result | |
|---|---|
| 1 | 0:00:00 |
| 2 | 1:00:00 |
| 3 | 2:00:00 |
| 4 | 3:00:00 |
| 5 | 4:00:00 |
Example 2: Generate durations in 30-minute steps
List.Durations(#duration(0, 8, 0, 0), 6, #duration(0, 0, 30, 0))Result | |
|---|---|
| 1 | 8:00:00 |
| 2 | 8:30:00 |
| 3 | 9:00:00 |
| 4 | 9:30:00 |
| 5 | 10:00:00 |
| 6 | 10:30:00 |
Example 3: Daily increments starting from 1 day
List.Durations(#duration(1, 0, 0, 0), 5, #duration(1, 0, 0, 0))Result | |
|---|---|
| 1 | 1.00:00:00 |
| 2 | 2.00:00:00 |
| 3 | 3.00:00:00 |
| 4 | 4.00:00:00 |
| 5 | 5.00:00:00 |