Record.TransformFields

Record

Applies transformation functions to specified fields in a record, returning a new record with the transformed values.

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

Syntax

Record.TransformFields(record as record, transformOperations as list, optional missingField as nullable number) as record

Parameters

NameTypeRequiredDescription
recordrecordYesThe source record.
transformOperationslistYesA list of transformation operations. Each element is a two-item list {fieldName, transformFunction} or a three-item list {fieldName, transformFunction, newFieldName}.
missingFieldnumberNoControls behavior when a specified field does not exist: MissingField.Error (default), MissingField.Ignore, or MissingField.UseNull.

Return Value

recordA new record with the specified fields transformed.

Remarks

Record.TransformFields applies transformation functions to specified fields in a record and returns a new record with the results. Each item in the transformOperations list describes one transformation:

- {fieldName, function} — a two-element list that applies function to the named field in place, keeping the same field name - {fieldName, function, newFieldName} — a three-element list that applies function to the named field and renames it to newFieldName

The transform function receives the current field value and must return the new value. Fields not listed in transformOperations are passed through unchanged. All transformations are applied to the original record — they are not chained sequentially — so the order of operations within the list does not matter.

Record.TransformFields is the record-level equivalent of Table.TransformColumns. Use it when you need to modify one or more field values within a record without constructing a new record literal manually. The optional missingField parameter controls behavior when a listed field does not exist: MissingField.Error (default, raises an error), MissingField.Ignore (skips the operation silently), or MissingField.UseNull (applies the function to null).

A common pattern is to use this function in Table.TransformRows or inside each expressions to normalize record fields while processing rows from a table.

Examples

Example 1: Uppercase a text field in a record

Record.TransformFields(
    [Name = "alice", Age = 30],
    {{"Name", Text.Upper}}
)
Result
Name
Age
1ALICE30

Example 2: Transform multiple fields at once

Record.TransformFields(
    [Name = "bob", Age = 25.7, City = "seattle"],
    {
        {"Name", Text.Proper},
        {"Age", Number.RoundDown},
        {"City", Text.Proper}
    }
)
Result
Name
Age
City
1Bob25Seattle

Example 3: Transform and rename a field using Sales data

let
    Row = Sales{0},
    Transformed = Record.TransformFields(
        Row,
        {{"UnitPrice", each _ * Row[Quantity], "LineTotal"}}
    )
in
    Record.SelectFields(Transformed, {"OrderID", "CustomerName", "LineTotal"})
Applied Steps

The final output — selects only OrderID, CustomerName, and LineTotal from the transformed record.

OrderID
CustomerName
LineTotal
11Alice100

Compatibility

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