Table.RemoveColumns

Table

Removes the specified columns from a table.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.RemoveColumns(table as table, columns as any, optional missingField as nullable number) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe input table to remove columns from.
columnsanyYesA column name or list of column names to remove.
missingFieldnumberNoControls behavior when a specified column does not exist. Use MissingField.Error (default), MissingField.Ignore, or MissingField.UseNull.

Return Value

tableA table without the specified columns.

Remarks

Table.RemoveColumns returns a new table with the specified columns removed. Pass a single column name as text, or multiple column names as a list.

If a specified column does not exist in the table, an error is raised by default. As a best practice, always provide the third argument MissingField.Ignore to silently skip missing columns. This prevents broken refreshes if an upstream column is renamed or removed from the data source.

Examples

Example 1: Remove a single column

Table.RemoveColumns(Sales, "Region")
Result
OrderID
CustomerName
Product
Category
UnitPrice
Quantity
OrderDate
11AliceWidget AWidgets2541/15/2024
22BobGadget BGadgets5021/18/2024
33CharlieWidget CWidgets15102/1/2024
44AliceGadget DGadgets7512/10/2024
55DianaWidget AWidgets2563/5/2024
66BobThingamajig EMisc12013/12/2024
77CharlieGadget BGadgets5034/1/2024
88DianaWidget CWidgets1584/15/2024

Example 2: Remove multiple columns

Table.RemoveColumns(Sales, {"Category", "Region"})
Result
OrderID
CustomerName
Product
UnitPrice
Quantity
OrderDate
11AliceWidget A2541/15/2024
22BobGadget B5021/18/2024
33CharlieWidget C15102/1/2024
44AliceGadget D7512/10/2024
55DianaWidget A2563/5/2024
66BobThingamajig E12013/12/2024
77CharlieGadget B5034/1/2024
88DianaWidget C1584/15/2024

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks