List.Select
The items of a list that meet a condition, in their order.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.Select(list as list, selection as function) as list
| Parameter | Type | Description |
|---|---|---|
list | list | The list. |
selection | function | A function of one item that answers true to keep it. |
Returns
list. The items kept.
Examples
Sales, not refunds
List.Select({120, -15, 85, 0, 40}, each _ > 0)
{120, 85, 40}
Products that are teas
List.Select({"Green tea", "Coffee", "Black tea"}, each Text.EndsWith(_, "tea"))
{"Green tea", "Black tea"}