Table.MatchesAnyRows

Table.MatchesAnyRows is a Power Query M function that evaluates if any rows in a table match a given condition. The function returns true if any rows match, and false otherwise.

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

Syntax

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

Description

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

Examples

Determine whether any of the row values in column [a] are even in the table ( {[a = 2, b = 4], [a = 6, b = 8]} ).

// Output: false
Table.MatchesAnyRows( 
    Table.FromRecords( {
        [a = 1, b = 4],
        [a = 3, b = 8]
    } ),
    each Number.Mod( [a], 2 ) = 0
 )

Determine whether any of the row values are [a = 1, b = 2], in the table ( {[a = 1, b = 2], [a = 3, b = 4]} ).

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

Other functions related to Table.MatchesAnyRows are:

BI Gorilla Youtube Channel

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