List.ContainsAll

List.ContainsAll is a Power Query M function that checks if a given list includes all the values from another list, with optional equation criteria for equality testing. The function returns true if all values are found in the list and false otherwise.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

List.ContainsAll(
   list as list,
   values as list,
   optional equationCriteria as any,
) as logical

Description

Indicates whether the list list includes all 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 and 4.

// Output: true
List.ContainsAll( {1, 2, 3, 4, 5}, {3, 4} )

Find out if the list {1, 2, 3, 4, 5} contains 5 and 6.

// Output: false
List.ContainsAll( {1, 2, 3, 4, 5}, {5, 6} )

Learn more about List.ContainsAll in the following articles:

Other functions related to List.ContainsAll are:

BI Gorilla Youtube Channel

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/list-containsall
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.