Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
509fg
New Member

Restoring a deleted column in power query without redoing all steps

Hi everyone,

I’m fairly new to Power Query and ran into an issue during data cleaning. After applying several steps, I realized that I need a column I had previously deleted earlier in the process.

I’d prefer not to redo all the subsequent steps just to recover that column. Is there a way to restore the deleted column without having to rebuild everything that comes after it?

Any tips or best practices would be really helpful. Thanks in advance

7 REPLIES 7
SundarRaj
Super User
Super User

Hi @509fg

 

An interesting trick to pull out the required column after doing a lot of steps is using a few functions together.
Table.AddIndexColumn.

Table.TransformColumns.

 

Assuming you are pulling a column named "Sum" from Step2 which was deleted in Step3, while being in Step7 now.
At Step7, we can write this code which will directly pull out the column with no previous steps required.
= Table.TransformColumns ( Table.AddIndexColumn ( Step7 , "Index" , 0 , 1 ) , { "Index" ,  each Step2 [Sum] { _ } } )

What this code essentially will do is pick out the row position in Step2 as per our Index column created and populate the respective 'Sum" values in the new column. 
A very important point to note: The RowCount in the previous step (Step2) that we are referring to extract the column should necessarily be the same rows as in the Step7.

Happy to connect and discuss more on this if this isn't clear on my part. Also, if a small reference file would be beneficial, please let me know.

Thanks,

Sundar Rajagopalan
v-veshwara-msft
Community Support
Community Support

Hi @509fg ,

We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.

v-veshwara-msft
Community Support
Community Support

Hi @509fg ,


Thanks for reaching out to Microsoft Fabric Community.

Just wanted to check if the responses provided were helpful. If further assistance is needed, please reach out.
Thank you.

cengizhanarslan
Super User
Super User

In the Applied Steps pane on the right, click the step immediately before the "Removed Columns" step that deleted your column. This takes you back in time to when the column still existed.

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.
pcoley
Solution Supplier
Solution Supplier

@509fg you don´t need to rebuild "all the steps", just those steps where you removed, reordered or expanded tables.
Please try going back to the step where you deleted the column and ajust the script as needed:
for example, in this step i deleted "Col1" and "col2", if i dont want to erase one of those i just need to remove that column from the list. 

pcoley_0-1777938741090.png

if i need to have col2 back then the sentence would be:
= Table.RemoveColumns(#"Sorted Rows",{"Col1"})

If you deleted the column using "removeother columns", then just go to the setting of that step and adjust as needed: 

pcoley_1-1777938947354.png

Make sure that if you reordered the columns then you have to include the deleted column in the sorted list. And if you have other steps removing columns, you need to do the adjustment of the lists of columns removed or kept. 



I hope this helps.
If so please Mark it as a solution.
Kudos are Welcome!
MasonMA
Super User
Super User

Hi,

To avoid repeating the process, i normally go to Advanced Editor and modify the M code manually

For example, you accidently removed ColumnB, find below step

= Table.RemoveColumns(Source, {"ColumnA", "ColumnB"})

 

Modify the code to 

= Table.RemoveColumns(Source, {"ColumnA"})

 

 

Hans-Georg_Puls
Super User
Super User

Hi @509fg
if I understand your question right, the following should help you:
You can remove each individual step by clicking the cross to the left of the step. Power Query will take care of the rest (cleaning up steps names, etc.).

 

But keep in mind that there is no undo for these kind of operations. I would recommend to save your report before you try to delete steps.

Does this help you?

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors