List.RemoveRange
A list without a run of items: from a position, one item or a set number of them.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.RemoveRange(list as list, index as number, optional count as nullable number) as list
| Parameter | Type | Description |
|---|---|---|
list | list | The list. |
index | number | Where the run starts, counted from 0. |
count | nullable number optional | How many items to remove; 1 when left out. |
Returns
list. The items before and after the run.
Examples
Without February and March
List.RemoveRange({"Jan", "Feb", "Mar", "Apr"}, 1, 2)
{"Jan", "Apr"}
One item
List.RemoveRange({"Jan", "Feb", "Mar", "Apr"}, 3)
{"Jan", "Feb", "Mar"}