List.MatchesAll
ListReturns true if the condition function returns true for every item in the list.
Syntax
List.MatchesAll(list as list, condition as function) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list to test. |
condition | function | Yes | A function that takes a list item and returns a logical value. |
Return Value
logical — True if the condition returns true for all items; false if any item fails the condition.
Remarks
List.MatchesAll applies a condition (predicate) function to every item in a list and returns true only if every item satisfies the condition. It is the list equivalent of the universal quantifier — "for all items, the condition holds."
Unlike List.AllTrue, which expects a pre-built list of logical values, List.MatchesAll accepts any list and evaluates the predicate on each item inline. This makes it the more idiomatic choice when working directly with a data list: List.MatchesAll(Sales[UnitPrice], each _ > 0) is cleaner than wrapping a List.Transform call.
An empty list returns true (vacuous truth). The function short-circuits as soon as a failing item is found. For the "at least one" check, use List.MatchesAny. For simple equality membership, List.Contains and List.ContainsAll are more appropriate.
Examples
Example 1: Check if all numbers are positive
List.MatchesAll({1, 5, 3, 8}, each _ > 0)Result | |
|---|---|
| 1 | TRUE |
Example 2: Check fails when one item doesn't match
List.MatchesAll({1, 5, -3, 8}, each _ > 0)Result | |
|---|---|
| 1 | FALSE |
Example 3: Validate all order amounts exceed minimum
let
OrderAmounts = {150.00, 225.50, 89.99, 310.00},
MinOrder = 50.00,
AllValid = List.MatchesAll(OrderAmounts, each _ >= MinOrder)
in
AllValidThe final output — checks whether every order amount in the list meets or exceeds the minimum order threshold, returning true because all values are above 50.
Result | |
|---|---|
| 1 | TRUE |