Power Query Undo lets you revert recent transformations in your data query, restoring previous states without restarting from scratch. It works by stepping backward through the Applied Steps list in the Query Editor, and requires no setup beyond having an active query open in Excel or Power BI. This feature is essential for correcting accidental changes, testing alternatives, or recovering from overwrites.

What You'll Need

  • Microsoft Excel 2016 or later, or Power BI Desktop
  • An open query in Power Query Editor (accessed via Data > Get Data > Transform Data or the Power Query tab)
  • At least one applied step in your query’s Applied Steps panel

Step-by-Step

  1. Open the Excel workbook or Power BI Desktop file containing your query.
  2. Go to the Data tab in Excel or the Home tab in Power BI, then select Transform Data or Transform Data > Edit Queries to open the Power Query Editor.
  3. In the Power Query Editor window, locate the Applied Steps pane on the right-hand side. This panel lists every transformation applied to your data, from the original source to the most recent step.
  4. Identify the step you wish to undo. Steps are listed in chronological order, with the most recent at the top.
  5. Right-click the step you want to remove. A context menu will appear.
  6. Select Delete from the context menu. This removes the step and all steps that came after it, effectively undoing the change.
  7. Alternatively, click directly on any earlier step in the Applied Steps list to make it the active state. This instantly reverts the query to the condition after that step, hiding all subsequent steps.
  8. After undoing the desired step(s), click Close & Apply in the top-left corner of the Power Query Editor to save your changes and return to the main Excel or Power BI interface.

Common Mistakes

  • Clicking the Undo button (Ctrl+Z) in the main Excel or Power BI window instead of in the Power Query Editor — this only reverses actions in the worksheet or report canvas, not the query transformations.
  • Deleting the wrong step without checking its dependencies — removing an early step may break later ones that rely on its output, causing errors when you click Close & Apply.
  • Assuming Undo works after closing the Power Query Editor — once you click Close & Apply, you cannot undo steps using the Applied Steps list until you reopen the editor.
  • Trying to undo a step that has been saved and closed multiple times — Power Query only remembers steps since the last time you clicked Close & Apply. There is no history beyond the current session.
  • Confusing the Power Query Undo with Excel’s worksheet Undo — they are entirely separate systems. Query edits are stored in the M code behind the scenes and are not affected by Ctrl+Z in the main grid.

Tips

  • Before applying major transformations like merging tables or pivoting columns, duplicate your query (right-click the query name in the Queries pane > Duplicate). This gives you a safety copy you can revert to if things go wrong.
  • Use descriptive names for your steps (double-click a step name to rename it) so it’s easier to identify what each one does when you need to undo.
  • After undoing a step, review the data preview pane to confirm the result matches your expectation before clicking Close & Apply.
  • If you’ve undone too far and want to restore a deleted step, you can often reapply it manually by repeating the original transformation — for example, re-filtering, re-sorting, or re-merging.
  • Use the View > Query Settings pane to see the M code generated by each step. This helps you understand what’s happening under the hood, especially when troubleshooting errors after undoing.
  • Keep your Applied Steps list clean by removing unnecessary steps like duplicate column creations or unused filters — it makes undoing more efficient and reduces clutter.

Troubleshooting

  • If you can’t see the Applied Steps pane, ensure you’re in Power Query Editor and not the main Excel or Power BI window. Go to View > Query Settings if the pane is hidden.
  • If right-clicking a step doesn’t show Delete, make sure you’re not on the source step (e.g., ‘Source’ or ‘Imported Table’). You cannot delete the source step — only transformations applied after it.
  • If clicking Close & Apply results in an error after undoing a step, check the error message. It may indicate a broken reference, such as a column name no longer existing. Reapply the step or adjust dependent steps manually.
  • If you accidentally closed the Power Query Editor without saving and want to undo changes, reopen the editor — your last saved state will be restored. Power Query does not auto-save unsaved edits.
  • If the query fails to load after undoing steps, verify your data source is still accessible (e.g., file paths haven’t changed, login credentials are valid). Undoing steps won’t fix broken connections.
  • If you’ve deleted multiple steps and now need a specific one back, use the “Advanced Editor” (View > Advanced Editor) to manually restore the M code from a backup or from a previously saved version of the query.

Frequently Asked Questions

Can I undo multiple steps at once in Power Query?

Yes. Simply right-click any step you want to revert to and select Delete. This removes that step and all steps after it. Alternatively, click directly on an earlier step in the Applied Steps list to make it active — all later steps disappear instantly.

Does Power Query Undo work after I close and reopen the file?

No. Power Query only retains the current set of applied steps within the session. Once you close and reopen the file, you can only undo steps that were applied since the last time you clicked Close & Apply. There is no version history or undo stack between sessions.

Can I use Ctrl+Z to undo a Power Query step?

No. Ctrl+Z only undoes actions in the Excel worksheet or Power BI report canvas. It has no effect on transformations made in the Power Query Editor. Always use the Applied Steps pane to undo query steps.

Why can’t I delete the Source step in Power Query?

The Source step represents the original data connection. It cannot be deleted because it’s the foundation of the query. You can only delete steps added after the source, such as filtering, renaming, or merging.

What happens to data if I undo a step that removed rows?

When you delete a filter or remove rows step, the data preview will restore all rows that were previously filtered out. Power Query doesn’t permanently delete data — it just hides it based on your steps. Undoing the step brings the hidden data back into view.

Is there a way to save multiple versions of a query in Power Query?

Not natively. Power Query doesn’t offer versioning. To preserve different versions, duplicate the query before making major changes. Right-click the query name > Duplicate. You can rename the copies (e.g., ‘Query_v1’, ‘Query_v2’) to keep track of them.