Table.ReplaceRows

Updated on

Table.ReplaceRows is a Power Query M function that replaces a specified number of rows in the input table with new rows, starting after the specified offset. The function returns a table with the replaced rows.

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

Syntax

Table.ReplaceRows(
   table as table,
   offset as number,
   count as number,
   rows as list,
) as table

Description

Table.ReplaceRows replaces a number of rows, count, in table with specified rows, starting after offset. The rows parameter is a list of records.

Examples

Starting at position 1, replace 3 rows.

Table.ReplaceRows( 
    Table.FromRecords( {
        [Column1 = 1],
        [Column1 = 2],
        [Column1 = 3],
        [Column1 = 4],
        [Column1 = 5]
    } ),
    1,
    3,
    {[Column1 = 6], [Column1 = 7]}
 )

 /* Output: 
Table.FromRecords( {
    [Column1 = 1],
    [Column1 = 6],
    [Column1 = 7],
    [Column1 = 5]
} )
 */ 

Other functions related to Table.ReplaceRows are:

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

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