Table.MatchesAllRows

Table.MatchesAllRows is a Power Query M function that checks if all rows in a table match a given condition. The function returns true if all rows match, and false otherwise.

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

Syntax

Table.MatchesAllRows(
   table as table,
   condition as function,
) as logical

Description

Indicates whether all the rows in the table match the given condition. Returns true if all of the rows match, false otherwise.

Examples

Determine whether all of the row values in column [a] are even in the table.

// Output: true
Table.MatchesAllRows( 
    Table.FromRecords( {
        [a = 2, b = 4],
        [a = 6, b = 8]
    } ),
    each Number.Mod( [a], 2 ) = 0
 )

Find if all of the row values are [a = 1, b = 2], in the table ( {[a = 1, b = 2], [a = 3, b = 4]} ).

// Output: false
Table.MatchesAllRows( 
    Table.FromRecords( {
        [a = 1, b = 2],
        [a = -3, b = 4]
    } ),
    each _ = [a = 1, b = 2]
 )

Other functions related to Table.MatchesAllRows are:

BI Gorilla Blog

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