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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
lava_
Helper I
Helper I

How to dynamically 1) remove deleted columns 2) add new columns and 3) update renamed columns?

I'm pretty unfamiliar with power query/M code, so trying my best here.

 

I've found videos that cover how to dynamically remove/add columns in power query. And I've also found videos that show how to dynamically update renamed columns. But is there a way that covers all three options in the M code? Or would I just add in all three options? If so, is there a particular order they need to go in?

 

We want to give users the ability to delete/add columns and rename existing ones without it breaking the refresh. I was trying to see if there's a way to add it dynamically so I don't have to manually make the changes in the code each time. 

 

Thank you!

2 REPLIES 2
ams1
Responsive Resident
Responsive Resident

Hi,

 

Given that this is a vibrant community (questions usually get answers quick), imo I think it's safe to say that questions that don't get a quick reply need more details/clarifications.

 

So "dynamically removing, adding, updating columns" is a SOLUTION, but at least I don't understand the PROBLEM -> https://xyproblem.info/

 

True, often revealing the PROBLEM/more details without exposing confidential things is not so easy, but I think we cannot help without more details (ex. the error that "breaks" the query etc.)

 

Shooting in the dark here:  IF the refresh breaks when columns are added, removed or updated, one reason for this might be that the column names are hardcoded in the query - right?

 

Sorry for not providing more details about what the actual problem is. I'm unfamiliar with power query and I'm confused about how to implement possible solutions I've found on youtube.

 

To answer your question, yes, the column names are hardcoded, and I am trying to figure out a way to make them dynamic so the refresh doesn't break. However, the solutions I've found cover the different scenarios (removing, adding, renaming columns) separately. So I'm not sure if I should implement them separately or if there is one solution out there that covers all three scenarios.

 

I hope that provides a little more clarity. Maybe I just need to spend more time learning about power query. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors