List.RemoveFirstN
This topic applies to the Power Query Formula Language which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.
Returns a list with the specified number of elements removed from the list starting at the first element. The number of elements removed depends on the optional countOrCondition parameter.
List.RemoveFirstN( table as table, optional countOrCondition as any) as table
| Argument | Description |
|---|---|
| list | The List to remove items from. |
| optional countOrCondition | Optional number of elements or condition to remove elements, default is 1 |
If countOrCondidtion is omitted only the first element is removed
If countOrCondidtion is a number, that many elements (starting from the top) will be removed)
If countOrCondidtion is a condition, the elements that meet the condition will be removed until an element does not meet the condition
List.RemoveFirstN
(
{1, 2, 3, 4, 5},
3
)
equals {4, 5}
List.RemoveFirstN
(
{5, 4, 2, 6, 1},
each _ > 3
)
equals { 2, 6, 1}
Show: