OpenBI Docs Buy

Table.RemoveColumns

The table without the columns you name.

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

Syntax

Table.RemoveColumns(table as table, columns as any, optional missingField as nullable number) as table
ParameterTypeDescription
tabletableThe table to take columns out of.
columnsanyA column name, or a list of names.
missingFieldnullable number
optional
What to do when a named column isn't there: MissingField.Error (the default) or MissingField.Ignore.

Returns

table. The other columns, in their order, with every row.

Remarks

  • A name that isn't a column is an error, unless missingField is MissingField.Ignore: useful when a source's columns come and go.
  • Table.SelectColumns names the columns to keep instead: new columns in the source then stay out.

Examples

Without price and cost

Table.RemoveColumns(#table({"Product", "Price", "Cost"}, {{"Chair", 50, 30}}), {"Price", "Cost"})
Product
Chair

A column that may not be there

Table.RemoveColumns(#table({"Product", "Price"}, {{"Chair", 50}}), {"Price", "Discount"}, MissingField.Ignore)
Product
Chair

Table.SelectColumns, Table.RenameColumns, Table.ColumnNames.

Last updated · OpenBI Studio 0.3.79