cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper IV
Helper IV

Changes in column name affecting subsequent Power Query steps

Hi guys, 

 

i have a recurring problem. I have a table in Power Query and a lot of transformations on that table. 

 

Now sometimes it happens that a column name changes in the original table or that i need to change a column name for better understanding. 

 

Now all subsequent steps where the column name is refferred to have to be updated for the new name. Is there an efficient way to do it for alle subsqeuent steps at once?

 

Thanks guys

1 ACCEPTED SOLUTION

Accepted Solutions
Super User II
Super User II

Hello @HR303 

 

you can copy paste the code into some editor and replacing your column-references at once.

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

3 REPLIES 3
New Member

In such scenerios you can create a view in database and use the view in Power Query. So whenever the changes in table , you can change the names in View. If the Power bi desktop you need to new name then at the end of power query step you can rename.

 

This is how we managed in some projects.

 

 

If you donot have control on database, write sql query to extract data from table so that use alias name.

Resident Rockstar
Resident Rockstar

@HR303 , I'm afraid you have to manually change those hard-coded column names one by one; but a more generic reference to the name of a certain column,

Table.ColumnNames(#"Some Step"){1}

renders your M code more flexible; so when you change a column's name next time, you don't need to adjust the M code again.

Super User II
Super User II

Hello @HR303 

 

you can copy paste the code into some editor and replacing your column-references at once.

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

Helpful resources

Announcements
November Update

Check it Out!

Click here to read more about the November 2020 Updates!

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform October Community Highlights

Check out the top community contributors across all of the communities

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors