List.MatchesAll
Whether every item of a list meets a condition.
Group: List. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
List.MatchesAll(list as list, condition as function) as logical
| Parameter | Type | Description |
|---|---|---|
list | list | The items to test. |
condition | function | A function of one item that answers true or false, such as each _ > 0. |
Returns
logical. true when the condition holds for every item; an empty list gives true.
Examples
All prices positive
List.MatchesAll({12.5, 8, 23}, each _ > 0)
true
All codes three letters long
List.MatchesAll({"NOR", "SWE", "DK"}, each Text.Length(_) = 3)
false
DK has two letters, so the answer is false.