List.Contains

List

Returns true if a list contains a specified value.

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

Syntax

List.Contains(list as list, value as any, optional equationCriteria as any) as logical

Parameters

NameTypeRequiredDescription
listlistYesThe list to search.
valueanyYesThe value to search for.
equationCriteriaanyNoA comparer function for custom equality testing.

Return Value

logicaltrue if the value is found in the list, false otherwise.

Remarks

List.Contains checks whether a specific value exists in a list. This is commonly used inside Table.SelectRows to filter rows where a column value is in a predefined set of values — similar to SQL's IN operator.

Examples

Example 1: Filter by a list of regions

let
    TargetRegions = {"East", "North"}
in
    Table.SelectColumns(
        Table.SelectRows(Sales, each List.Contains(TargetRegions, [Region])),
        {"OrderID", "CustomerName", "Region"}
    )
Result
OrderID
CustomerName
Region
11AliceEast
23CharlieEast
34AliceNorth
46BobEast
58DianaNorth

Compatibility

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