List.Select

List

Returns items from a list that match a condition.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

List.Select(list as list, selection as function) as list

Parameters

NameTypeRequiredDescription
listlistYesThe list to filter.
selectionfunctionYesA function that returns true for items to keep.

Return Value

listA list containing only the items that satisfy the condition.

Remarks

List.Select filters a list by applying a condition function to each item, returning only items where the function returns true. This is the list equivalent of Table.SelectRows.

Examples

Example 1: Select high prices

let
    Prices = Table.Column(Products, "Price"),
    HighPrices = List.Select(Prices, each _ > 30)
in
    #table({"Price"}, List.Transform(HighPrices, each {_}))
Result
Price
150
275
3120

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks