List.Contains
List function · By Tahir Nas · Examples run in our simulator · Published · Updated
Tests whether a list contains a value.
When to use it
Use it to test membership: keep rows whose value appears in an allowed list, or flag values that appear in another table's column. For a few values it reads better than a chain of or conditions, and the list can come from a parameter or another query.
Syntax
List.Contains(list as list, value as any, optional equationCriteria as any) as logicalReturns
true or false.
Example
List.Contains({"Kite", "Reel"}, "Reel")Result
true
Example: flag rows found in another table
Comparing against another table's column marks matches without a merge.
Table.AddColumn(#table({"Cust"}, {{"A"}, {"B"}}), "Blocked", each List.Contains(#table({"Cust"}, {{"B"}})[Cust], [Cust]), type logical)Result
| Cust | Blocked |
|---|---|
| A | false |
| B | true |
Both results are produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M, and checked on every build.
Good to know
- Useful for filtering against a list from another table.
Common mistakes
- Calling it on a large table column inside every row without buffering the list.
- Case differences between the two sides.
Exercises that use List.Contains
- intermediate~7 minFree
Keep orders for a list of products (kite shop)
Keep only orders whose Product is in the promotion list held in a separate PromoProducts table.
- beginner~7 minFree
Convert Yes/No answers to true, false or null (charity)
The marketing opt-in column mixes Yes, Y, no, N, blanks and nulls. Turn it into a proper true/false column.
- advanced~10 minPro
Unpivot only the quarter columns, whatever else the sheet has (budget)
The sheet has quarter columns (Q1 2026 …) and descriptive columns that change over time. Unpivot just the quarters.
Learn more
- Filter rows by value lesson
Related functions
Official documentation: List.Contains on Microsoft Learn.