List.AnyTrue
ListReturns true if any value in the list evaluates to true.
Syntax
List.AnyTrue(list as list) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
list | list | Yes | The list of logical values to evaluate. |
Return Value
logical — True if at least one value in the list is true; false otherwise.
Remarks
List.AnyTrue returns true if at least one item in the list is logically true. It short-circuits and stops evaluating as soon as the first true value is found. An empty list returns false — there are no items that could satisfy the condition.
Null values are treated as false, so a list of only nulls returns false. Non-logical values (such as numbers or text) will cause a type error; use List.Transform to evaluate a condition on each item and produce a list of logical values first.
The typical pattern is List.AnyTrue(List.Transform(someList, each . As a more concise alternative, List.MatchesAny accepts a list and a predicate function in one call. For simple membership checks, List.Contains is more idiomatic.
Examples
Example 3: Check if any order in the Sales table has a total over $200
let
Sales = #table(
{"CustomerName", "UnitPrice", "Quantity"},
{{"Alice", 25.00, 4}, {"Bob", 50.00, 2}, {"Charlie", 15.00, 10}, {"Diana", 25.00, 6}}
),
Totals = List.Transform(
Table.ToRows(Sales),
each _{1} * _{2}
),
AnyLarge = List.AnyTrue(List.Transform(Totals, each _ > 200))
in
AnyLargeThe final output — checks whether any order total exceeds 200; all totals are 150 or less, so returns false.
Result | |
|---|---|
| 1 | FALSE |