Table.TransformColumns

Table

Applies transformation functions to the values in one or more columns.

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

Syntax

Table.TransformColumns(table as table, transformOperations as list, optional defaultTransformation as nullable function, optional missingField as nullable number) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe input table whose column values are to be transformed.
transformOperationslistYesA list of {columnName, transformFunction} pairs, or {columnName, transformFunction, newType} triples.
defaultTransformationfunctionNoA function to apply to all columns not listed in transformOperations.
missingFieldnumberNoControls behavior when a specified column does not exist. Use MissingField.Error (default) or MissingField.Ignore.

Return Value

tableThe input table with the specified columns transformed by the given functions.

Remarks

Table.TransformColumns applies a function to every value in one or more columns. Unlike Table.TransformColumnTypes which changes the data type, this function transforms the actual values — for example, converting text to uppercase, rounding numbers, or extracting parts of a date.

This function preserves query folding in scenarios where Table.TransformColumnTypes does not. When working with database sources, prefer Table.TransformColumns with a conversion function over Table.TransformColumnTypes for type-related transformations.

Include the type as the third element in each transformation triple (e.g., {"Column", Text.Upper, type text}) to keep the column typed without needing a separate Table.TransformColumnTypes step.

Examples

Example 1: Transform text to uppercase

Table.SelectColumns(
    Table.TransformColumns(Sales, {{"CustomerName", Text.Upper, type text}}),
    {"OrderID", "CustomerName", "Product"}
)
Result
OrderID
CustomerName
Product
11ALICEWidget A
22BOBGadget B
33CHARLIEWidget C
44ALICEGadget D
55DIANAWidget A
66BOBThingamajig E
77CHARLIEGadget B
88DIANAWidget C

Example 2: Round numeric values

Table.SelectColumns(
    Table.TransformColumns(Sales, {{"UnitPrice", each Number.Round(_, 0), type number}}),
    {"Product", "UnitPrice"}
)
Result
Product
UnitPrice
1Widget A25
2Gadget B50
3Widget C15
4Gadget D75
5Widget A25
6Thingamajig E120
7Gadget B50
8Widget C15

Compatibility

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