OpenBI Docs Buy

Table.ReplaceRows

Takes out a run of rows at a position and puts other rows in their place.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Table.ReplaceRows(table as table, offset as number, count as number, rows as list) as table
ParameterTypeDescription
tabletableThe table to change.
offsetnumberThe position of the first row to take out, counting from 0.
countnumberHow many rows to take out.
rowslistThe rows to put in, as records with the table's columns: more or fewer than count is fine.

Returns

table. The rows before the run, the new rows, then the rows after it.

Examples

One row out, two in

Table.ReplaceRows(
    #table({"Product", "Price"}, {{"Chair", 50}, {"Desk", 120}, {"Lamp", 30}}),
    1, 1,
    {[Product = "Desk", Price = 110], [Product = "Shelf", Price = 75]})
ProductPrice
Chair50
Desk110
Shelf75
Lamp30

Table.InsertRows, Table.RemoveRows, Table.ReplaceMatchingRows.

Last updated · OpenBI Studio 0.3.79