List.Range
A run of items from the middle of a list: from a position, a set number of them or all the rest.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.Range(list as list, offset as number, optional count as nullable number) as list
| Parameter | Type | Description |
|---|---|---|
list | list | The list. |
offset | number | Where the run starts, counted from 0. |
count | nullable number optional | How many items to take; to the end when left out. |
Returns
list. The items of the run.
Remarks
- A count that reaches past the end stops at the end.
Examples
March to May
List.Range({"Jan", "Feb", "Mar", "Apr", "May", "Jun"}, 2, 3)
{"Mar", "Apr", "May"}
From April on
List.Range({"Jan", "Feb", "Mar", "Apr", "May", "Jun"}, 3)
{"Apr", "May", "Jun"}