Power Query Course
Lab 05

Futureproof Column Selection

Learn why deleting unwanted columns is fragile, and why selecting the columns you need and removing everything else is the safer, more professional approach.

~15 minutes
Level: Beginner
Tool: Microsoft Excel

Concept

A common mistake when cleaning wide tables is to delete the columns you don't need. It works today — but next month, if the source file arrives with two extra columns, your "Remove Columns" step silently discards them too. And if a column you deleted reappears with a new name, Power Query may throw an error on the step that followed it.

The professional habit is the opposite: select only the columns you want to keep, then choose Remove Other Columns. This step is anchored to the columns you specified — not to the columns you didn't. Future changes to the source file's width have no effect on your query whatsoever.

Lab File — pq2b.xlsx This lab uses an Excel file. Create a new query and navigate to the correct sheet inside it.
Download File
Lab Instructions
# Steps Directions
1 Create a new query and source data from Excel File 2B.
2 Select the GL transactions sheet.
3 Promote headers.
4 Sure enough — we've got 35 columns of data. Only 6 are useful.
5 It is tempting at this point to select and delete column 7 onwards. However, thinking about automation and futureproofing — what if next time there are 37 columns?
6 A better method is to select the columns you want to keep, and remove the others. Select first 6 columns Home Remove Columns Remove Other Columns
Remove Columns vs. Remove Other Columns: "Remove Columns" hard-codes the names of columns to delete — fragile when the source changes. "Remove Other Columns" hard-codes only the columns you want — everything else is discarded automatically, no matter how many extra columns appear in future files.
Power Query Course · askfarouk.net Ahmed Farouk — Microsoft Certified Trainer