Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Table.DuplicateColumn: How to Copy a Column

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Table.DuplicateColumn in Power Query creates a copy of an existing column and gives it a new name, leaving the original untouched. You use it when you need the same data twice — for example, to keep a raw value while transforming a second copy, or to split one column into two differently formatted versions. The function is a table transformation, so it works inside the Power Query Editor in Excel or Power BI, not in a worksheet formula. You will need a query that already loads a table, and you should know the exact name of the column you want to copy.

What You'll Need

  • Excel (Microsoft 365 or a recent perpetual version) or Power BI Desktop with the Power Query Editor available.
  • A query that returns a table — either loaded from a worksheet, a CSV, a database, or created with Enter Data.
  • The exact column name as it appears in the query, including spaces and capitalization.
  • A new name for the duplicate column that does not already exist in the table.

Step-by-Step

  1. Open the Power Query Editor. In Excel, select any cell in your table and go to Data > From Table/Range. In Power BI Desktop, use Home > Transform data. Menu labels can differ slightly by version and region, but the Data and Home tabs are the usual starting points.
  2. In the Queries pane on the left, select the query that contains the column you want to duplicate.
  3. Locate the column in the data preview. You can scroll horizontally or use the column header drop-down to confirm the name.
  4. Right-click the column header and choose Duplicate Column. Power Query immediately adds a copy to the right of the original, named something like ColumnName - Copy.
  5. Rename the duplicate to something meaningful: double-click the new header, type the new name, and press Enter. Avoid names that already exist in the table.
  6. If you prefer writing M code directly, open the Advanced Editor from the Home tab and add a step such as Table.DuplicateColumn(PreviousStep, "SourceColumn", "NewColumnName"). Replace PreviousStep with the name of the step you are duplicating from.
  7. Apply any transformations to the duplicate column — for example, change its type, trim text, or split it — while leaving the original unchanged.
  8. When finished, select Close & Load (Excel) or Close & Apply (Power BI) to commit the changes.

Common Mistakes

  • Using a name that already exists. Power Query will not create a duplicate column with the same name as an existing one; the step fails with an error about a duplicate column name.
  • Misspelling the source column in M code. Table.DuplicateColumn is case-sensitive about the column name string. A typo produces an Expression.Error saying the column was not found.
  • Duplicating before filtering. If you duplicate a column and then filter rows, both copies are affected by the row filter — duplication copies values, not an independent snapshot.
  • Forgetting to rename. Leaving the default "- Copy" name makes later steps hard to read and can collide with a second duplicate.
  • Expecting the duplicate to stay linked. The copy is a static duplicate of the values at that step; changes you make to the original later in the query do not flow into the copy.

Tips

  • Duplicate first, then transform the copy. This keeps the original column available for reference, auditing, or a later merge.
  • Give the duplicate a name that describes its purpose, such as OrderDate_Text or CustomerID_Key, so the Applied Steps list stays readable.
  • Use the Advanced Editor to review the generated step. The UI writes a Table.DuplicateColumn call for you, which is a quick way to learn the syntax.
  • If you need many copies, consider whether a single column with a custom transformation would be simpler than several duplicates.
  • Keep the duplicate close to the original in the step order; moving it far down the query makes debugging harder.

Troubleshooting

If the Duplicate Column option is greyed out, make sure you right-clicked the column header itself and not a cell or the table background. If the step errors with a message that the column was not found, check the exact spelling in the previous step — column names can change after a rename or a merge. If you see an error about a duplicate name, rename the new column to something unique. If the query is slow after duplication, remember that each duplicate adds a column to the table; remove copies you no longer need. If the Advanced Editor shows a step you did not expect, use the Applied Steps list to delete the step and start again. When an error persists, check the step immediately before the duplicate — that is usually where the column name or table reference went wrong.

Frequently Asked Questions

Does Table.DuplicateColumn change the original column?

No. It adds a new column with copied values and leaves the original in place.

Is the duplicate linked to the original?

No. It is a separate column containing the values as they were at that step. Later transformations on one do not affect the other.

Can I duplicate a column in Power BI Desktop?

Yes. The Power Query Editor in Power BI Desktop offers the same right-click Duplicate Column command and the same Table.DuplicateColumn function.

Why is my duplicate column named "- Copy"?

Power Query assigns a default name when you use the ribbon or right-click command. Rename it to something descriptive.

Can I duplicate a column with M code only?

Yes. Add a step in the Advanced Editor using Table.DuplicateColumn with the previous step name, the source column name, and the new column name.

What happens if I duplicate a column that does not exist?

The step fails with an Expression.Error stating the column was not found. Check the spelling against the previous step.