List.ContainsAny is a Power Query M function that checks if a given list includes any of the values from another list, with optional equation criteria for equality testing. The function returns true if any value is found in the list and false otherwise.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
List.ContainsAny(
list as list,
values as list,
optional equationCriteria as any,
) as logical
Argument | Attribute | Description |
---|---|---|
list | The list of values to check. | |
values | The values to check existence of within the list. | |
equationCriteria | optional | Uses Comparer Functions to determine how values are equated during operations. Options include Comparer.Ordinal for exact case-sensitive matching, Comparer.OrdinalIgnoreCase for case-insensitive matching, and Comparer.FromCulture for culture-specific comparisons. |
Description
Indicates whether the list list
includes any of the values in another list, values
.
Returns true if value is found in the list, false otherwise. An optional equation criteria value, equationCriteria
, can be specified to control equality testing.
Examples
Find out if the list {1, 2, 3, 4, 5} contains 3 or 9.
// Output: true
List.ContainsAny( {1, 2, 3, 4, 5}, {3, 9} )
Find out if the list {1, 2, 3, 4, 5} contains 6 or 7.
// Output: false
List.ContainsAny( {1, 2, 3, 4, 5}, {6, 7} )
Related articles
Learn more about List.ContainsAny in the following articles:
- Lists in Power Query M / List Functions (200+ Examples)
The complete guide to Lists in Power Query M. Learn from practical examples and master Power Query’s most powerful List functions. » Read more
Related functions
Other functions related to List.ContainsAny are:
