List.Contains
ListReturns true if a list contains a specified value.
Syntax
List.Contains(list as list, value as any, optional equationCriteria as any) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to search. |
value | any | Yes | The value to search for. |
equationCriteria | any | No | A comparer function for custom equality testing. |
Return Value
logical — true 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 | |
|---|---|---|---|
| 1 | 1 | Alice | East |
| 2 | 3 | Charlie | East |
| 3 | 4 | Alice | North |
| 4 | 6 | Bob | East |
| 5 | 8 | Diana | North |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks