List.ContainsAny
ListReturns true if a list contains any of the values in another list.
Syntax
List.ContainsAny(list as list, values as list, optional equationCriteria as any) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to search. |
values | list | Yes | The list of values to check for. |
equationCriteria | any | No | A comparer function for custom equality testing. |
Return Value
logical — true if any value from the second list is found in the first list.
Remarks
List.ContainsAny returns true if at least one value from the second list appears in the first list. This is useful for checking membership against multiple possible values at once.
Examples
Example 1: Check for target categories
let
Categories = List.Distinct(Table.Column(Sales, "Category")),
HasGadgets = List.ContainsAny(Categories, {"Gadgets", "Electronics"})
in
#table({"HasGadgets"}, {{HasGadgets}})Result
HasGadgets | |
|---|---|
| 1 | TRUE |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks