How to Undo in Power Query

If you’re working with data transformations in Power Query and make a mistake, you might instinctively reach for Ctrl+Z like you would in Excel.

Unfortunately, that won’t work with Power Query.

Power Query doesn’t have a traditional undo button, but don’t worry – there’s still a straightforward way to reverse your changes.

How to Undo One Step

Suppose you have the query below with five applied steps, and you realize that the last step (Grouped Rows) was a mistake.

Power Query with multiple steps to undo a step.

To undo this step, simply hover your mouse pointer over the step in the Applied Steps pane and click the X icon that appears next to it.

Click on the 'X' icon to undo a step in power query

The step will be deleted immediately, and your data will revert to how it looked before that transformation was applied.

You can also right-click on any step and select “Delete” from the context menu as an alternative to using the X icon.

How to Undo Multiple Steps

Sometimes you need to undo several steps at once.

For example, if you have five applied steps and want to remove the third step along with everything that came after it.

Power Query steps

To delete multiple steps:

  1. Right-click on the step where you want to start deleting (the third step in this example)
  2. Select “Delete Until End” from the shortcut menu
Right-click on a step and then click on Delete until end.

This will remove the selected step and all subsequent steps in one go.

Instead of permanently deleting steps, you can also click on any previous step in the Applied Steps pane to see what your data looked like at that point. This doesn’t delete anything – it just shows you the state of your data at that step. You can then decide whether you want to delete the later steps or modify them.

Important Warnings and Limitations

Before you start deleting steps in Power Query, here are some critical things you need to know:

No Recovery Option

Unlike Excel’s Ctrl+Z, once you delete a step in Power Query, you cannot get it back. There’s no undo for the undo. Always double-check before deleting.

Step Dependencies

Power Query will warn you if deleting a step might break your query. This happens when later steps depend on transformations made in earlier steps. For example:

  • If you delete a step that removed a column, but a later step tries to use that column
  • If you delete a step that changed data types, but subsequent steps expect those specific data types
Warning when deleting a step in power query

Source Steps Cannot Be Deleted

You cannot delete the “Source” step (usually the first step) as it defines where your data comes from.

Immediate Effect

When you delete a step, the change takes effect immediately in the preview. However, the full refresh happens when you close and apply the query.

Performance Impact

Deleting early steps forces Power Query to recalculate all remaining steps, which can be slow with large datasets.

Query Dependencies

If other queries reference this query, deleting steps here might break those dependent queries.

Best Practices for Safe Undoing

  • Test Before Committing: Before making major changes, consider duplicating your query so you have a backup version.
  • Work from Bottom Up: When deleting multiple steps, it’s usually safer to delete from the most recent step backward rather than deleting middle steps.
  • Check Preview: Always review the data preview after deleting steps to ensure your data still looks correct.
  • Save Regularly: Close and apply your changes periodically so you’re not working with too many unsaved modifications.

When Deleting Steps Goes Wrong

If you delete a step and see error messages in subsequent steps, you have a few options:

  • Restore the step: Unfortunately, you’ll need to recreate the deleted step manually
  • Modify dependent steps: Edit the steps that are now broken to work without the deleted transformation
  • Start over: In some cases, it might be easier to start fresh from an earlier point in your query

Power Query’s step-by-step approach makes it relatively easy to undo changes, even without a traditional undo button.

The key is understanding that each step builds on the previous one, so deleting steps can have a cascading effect on everything that follows.

Remember, 99% of the time when you need to “undo” something in Power Query, deleting the problematic step (or steps) from the Applied Steps pane is exactly what you need to do.

Other Excel articles you may also like:

I am a huge fan of Microsoft Excel and love sharing my knowledge through articles and tutorials. I work as a business analyst and use Microsoft Excel extensively in my daily tasks. My aim is to help you unleash the full potential of Excel and become a data-slaying wizard yourself.