Table.MatchesAllRows Function in Power Query
The Table.MatchesAllRows function in Power Query (M language) is used to determine whether all rows in a table satisfy a specified condition. It returns a logical value (true or false).
Syntax
Table.MatchesAllRows( table as table, condition as function ) as logical
The function has the following parameters:
- table: The input table to evaluate.
- condition: A function that defines the condition to test for each row. It must return a boolean (
true
orfalse
).
Example: Check If All Sales Are Above 100.
Power Query M
let Source = Table.FromRecords({ [Name = "Ashish", Sales = 150], [Name = "Katrina", Sales = 120], [Name = "Alia", Sales = 110] }), Result = Table.MatchesAllRows(Source, each [Sales] > 100) in Result
The output of the above code is true which is of Logical datatype.