TableAction.DeleteRows is a Power Query M function that creates an action to remove rows from a table, returning the deleted rows as they existed before the deletion.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
TableAction.DeleteRows( table as table ) as any
Description
Creates an action to delete the rows in table
. The action returns a table containing the deleted rows as they appeared in table
before the action executed.
To delete a subset of the rows in table
, use Table.SelectRows
to apply a filter to table
before using TableAction.DeleteRows
.
The function raises an evaluation error if table
is not updatable.
The action raises an execution error if the operation fails.
NOTE: table
may be left in a partially updated state if an execution error occurs.
Examples
Here’s an example from Ben Gribaudo:
let
Data = Sql.Database("server", "database"){[Name = "SomeTable"]}[Data],
FilteredTable = Table.SelectRows(Data, each [ID] >= 10),
DeleteAction = TableAction.DeleteRows(FilteredTable)
in
DeleteAction
Related articles
Learn more about TableAction.DeleteRows in the following articles:
- M Mysteries: The Mysterious Type Action—An M-Internal Means to Write Data Modifications to External Systems
In his article “M Mysteries: The Mysterious Type Action,” Ben Gribaudo explores Power Query’s hidden capability to perform data modifications—such as inserts, updates, and deletes—using the undocumented ‘action’ type. Although Power Query is primarily designed for data retrieval and transformation, Gribaudo reveals that it possesses internal functions that can interact with external data sources to modify data. These functions, however, are not intended for general use and require the Power Query SDK for implementation. » Read more
Related functions
Other functions related to TableAction.DeleteRows are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy