Table.DuplicateColumn

Table

Duplicates a column in a table with a new name.

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

Syntax

Table.DuplicateColumn(table as table, columnName as text, newColumnName as text, optional columnType as nullable type) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe input table.
columnNametextYesThe name of the column to duplicate.
newColumnNametextYesThe name of the new duplicate column.
columnTypetypeNoOptional type for the new column.

Return Value

tableThe input table with a new column that is a copy of the specified column.

Remarks

Table.DuplicateColumn creates a copy of an existing column with a new name. This is useful when you want to transform a column but also keep the original values — duplicate first, then transform the copy.

The new column is appended to the end of the table. Use Table.ReorderColumns if you need it in a specific position.

Examples

Example 1: Duplicate a column for transformation

Table.SelectColumns(
    Table.DuplicateColumn(Table.FirstN(Sales, 3), "Product", "OriginalProduct"),
    {"OrderID", "Product", "OriginalProduct"}
)
Result
OrderID
Product
OriginalProduct
11Widget AWidget A
22Gadget BGadget B
33Widget CWidget C

Compatibility

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