Table.MatchesAllRows

Updated on

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

Table.MatchesAllRows checks if all rows in the table meet a given condition. It returns true if all 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:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-matchesallrows

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy