List.Repeat
ListReturns a list created by repeating the given list a specified number of times.
Syntax
List.Repeat(list as list, count as number) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to repeat. |
count | number | Yes | The number of times to repeat the list. |
Return Value
list — A new list that is the source list concatenated with itself count times.
Remarks
List.Repeat concatenates the input list with itself count times, producing a longer list of repeated elements. The result has List.Count(list) * count elements, in the same order as the original repeated count times.
This function is useful for creating repeating label patterns (e.g., Q1, Q2, Q3, Q4 repeating across years), generating cyclic sequences, or padding a structure to a required length. For adding a single repeated value n times, pass a single-element list: List.Repeat({value}, n).
count must be a non-negative integer. Passing 0 returns an empty list; passing 1 returns a copy of the original list. For combining two different lists into one, use List.Combine instead.
Examples
Example 2: Create a repeating pattern of labels
List.Repeat({"Q1", "Q2", "Q3", "Q4"}, 3)Result | |
|---|---|
| 1 | {Q1, Q2, Q3, Q4, Q1, Q2, Q3, Q4, Q1, Q2, Q3, Q4} |
Example 3: Pad a list with a repeated filler value
let
FillerList = List.Repeat({null}, 5)
in
FillerListResult | |
|---|---|
| 1 | {null, null, null, null, null} |