Record.RemoveFields

Record

Returns a record with the specified fields removed.

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

Syntax

Record.RemoveFields(record as record, fields as any, optional missingField as nullable number) as record

Parameters

NameTypeRequiredDescription
recordrecordYesThe record to remove fields from.
fieldsanyYesA field name or list of field names to remove.
missingFieldnumberNoA MissingField enum value that controls behavior when a specified field does not exist. Options are MissingField.Error (default), MissingField.Ignore, or MissingField.UseNull.

Return Value

recordA record without the specified fields.

Remarks

Record.RemoveFields returns a new record with the specified fields excluded. This is the record-level equivalent of Table.RemoveColumns. Use the optional missingField parameter to control what happens when a field you try to remove does not exist — by default an error is raised, but you can choose to ignore missing fields with MissingField.Ignore.

Examples

Example 1: Remove OrderDate and Region from a Sales row

let
    Trimmed = Record.RemoveFields(Sales{0}, {"OrderDate", "Region"})
in
    Record.ToTable(Trimmed)
Result
Name
Value
1OrderID1
2CustomerNameAlice
3ProductWidget A
4CategoryWidgets
5UnitPrice25
6Quantity4

Compatibility

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