Safely removing columns in Power Query

Error when removing columns in Power Query

In Power Query, if you remove a column that does not exist, you’ll get an error. While you probably aren’t going to remove a non-existent column on purpose, this may happen when the column in question is removed from your data source.

A popular way to prevent this error from happening is to use the Table.SelectColumns function instead of Table.RemoveColumns. This may potentially bloat your query code if you have many columns to select. You may also use try and otherwise, which again makes your code unnecessarily long. In this blog post, I’m showing an alternative solution. Continue reading “Safely removing columns in Power Query”