Table.ReplaceMatchingRows Function in Power Query

The Table.ReplaceMatchingRows function in Power Query, replaces specific rows from a table with the new rows.

Syntax

Table.ReplaceMatchingRows(
    table as table, 
    replacements as list, 
    optional equationCriteria as any
) as table 

The function has the following parameters:

Example: Updating Prices. Imagine we have a product table, and we want to replace old prices with new ones.

Power Query M

let
    // Source product table created from records (field names -> less error-prone)
    Products = Table.FromRecords({
        [ProductID = 101, Price = 50],
        [ProductID = 102, Price = 75],
        [ProductID = 103, Price = 100]
    }),

    // Replacements: each item is a pair { oldRecord, newRecord }
    // Here we match the whole row exactly (ProductID + Price) and replace it.
    Replacements = {
        { [ProductID = 101, Price = 50], [ProductID = 101, Price = 55] },  // 101: 50 -> 55
        { [ProductID = 103, Price = 100], [ProductID = 103, Price = 90] }   // 103: 100 -> 90
    },

    // Apply replacements (full-row match)
    Updated = Table.ReplaceMatchingRows(Products, Replacements)
in
    Updated   

The output of the above code is shown below:

Table.ReplaceMatchingRows function in Power Query