Table.MatchesAnyRows

Updated on

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

Table.MatchesAnyRows checks if any row in the table meets a given condition. It returns true if any row matches, 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:

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

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