Skip to main content

How to Duplicate a Query in Power Query

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

Sometimes you need the same data shaped two ways: one row per category, and one row per category manager, for example. Duplicate copies a query with all its steps, so you can change the copy without touching the original. Here's how, and when to use Reference instead.

The example duplicates Expense Categories, a query of a SharePoint list with one row per category and a Managers column that can hold several people (How to Get Data from a SharePoint List in Power BI in the Browser). The copy becomes a query with one row per manager, and the original stays as it is.

Step 1: Select Duplicate​

Under Queries, right-click the query and select Duplicate:

The shortcut menu of the Expense Categories query with Copy, Paste, Delete, Rename, Enable load, Include in report refresh, Duplicate outlined in red, Reference, Move to group, Move up, Move down, Create function..., Convert to parameter, Advanced editor and Properties...

Step 2: Check the Copy​

A new query appears under Queries, now Queries [3], named after the original with (2): Expense Categories (2). It has the original's steps, here Source and Navigation 1, and the same rows:

Queries [3] with Expense Categories, Expenses and Expense Categories (2) selected, showing the same three rows Travel, Office and Meals, and Query settings with the Name Expense Categories (2) and the Applied steps Source and Navigation 1

The copy is independent: steps you add to it don't change the original, and the other way round. Give it a name that says what it's for (How to Rename a Query in Power Query). The example's copy became Category managers, with one row per manager (How to Get the Email from a SharePoint Person Column in Power Query).

Duplicate or Reference?​

The same menu has Reference, which makes a new query whose source is the result of the original:

DuplicateReference
The new query starts fromThe same source, with a copy of every stepThe original query's result
A later change to the originalDoesn't reach the copyFlows into the new query
Good forShaping the same source two different waysBuilding on a query you want to keep in step

In the example, the original later dropped its Managers column, which the copy needs. A Reference would have lost it too, so Duplicate was the right choice.

Common Mistakes​

MistakeWhat happensDo this instead
Reference when the original will drop columns the new query needsThe new query loses themDuplicate
Duplicate when both should always matchA fix to one isn't made in the otherReference
Keeping the name (2)Nobody can tell what the copy is forRename it

Troubleshooting​

SymptomLikely causeFix
A change to one query appears in the otherIt was a ReferenceDuplicate the original instead
The copy loads into the model but isn't needed thereEvery query loads by defaultUntick Enable load in its shortcut menu

FAQ​

Does a duplicate read the source twice?​

Each query has its own Source step, so each one reads the list on its own.

Where do I find the queries of a semantic model I already made?​

Open the model and select Transform data, which opens Power Query with every query under Queries (Edit semantic models in the Power BI service).

Conclusion​

Right-click the query under Queries and select Duplicate. The copy has every step and changes independently; use Reference when the new query should follow the original. The example duplicated Expense Categories into what became Category managers.

Additional Resources​