Power Query Filter Columns: Step-by-Step Guide
In this article
Filtering columns in Power Query means keeping only the columns you actually need, either by removing the ones you do not want or by selecting the ones you do. The quickest working method is to select the columns you want to keep, right-click a column header, and choose Remove Other Columns; to drop specific columns instead, select them and choose Remove Columns. Both actions are recorded as steps in the Applied Steps list, so you can review, reorder, or delete them later. This keeps your queries lean, reduces refresh time, and prevents unrelated columns from breaking downstream steps when a source changes.
What You'll Need
- Power BI Desktop, Excel with Power Query (Data > Get & Transform Data), or another host that includes the Power Query Editor.
- A data source already connected and loaded into the Power Query Editor, or permission to connect to one.
- Basic familiarity with the Power Query Editor window: the ribbon, the Queries pane on the left, the data preview in the middle, and the Applied Steps pane on the right.
Menu labels can differ slightly by version, host application, and region. The steps below use the Power Query Editor as it appears in current Power BI Desktop and Excel; the same commands exist in both, though their ribbon positions may vary.
Step-by-Step
- Open the Power Query Editor. In Excel, go to Data > Get & Transform Data > Launch Power Query Editor. In Power BI Desktop, click Transform data on the Home ribbon. If you have not connected to data yet, use Get Data first and complete the connection dialog.
- Select the query you want to filter. In the Queries pane on the left, click the query name. The data preview updates to show that table.
- Decide whether to keep or remove. If most columns are needed, remove the few you do not want. If only a handful are needed, keep those and remove the rest. This decision matters because the Applied Steps list records whichever action you take.
- To keep selected columns: hold Ctrl (Windows) or Cmd (Mac) and click each column header you want to keep. Then right-click one of the selected headers and choose Remove Other Columns. Alternatively, use Home > Choose Columns, tick the columns to keep, and click OK; this opens a dialog that lets you search and reorder before confirming.
- To remove selected columns: hold Ctrl or Cmd and click the headers you want to drop. Right-click one selected header and choose Remove Columns. To remove several adjacent columns at once, click the first header, hold Shift, click the last header, then right-click and remove.
- Check the Applied Steps pane. A new step named Removed Columns or Removed Other Columns appears on the right. Click it to confirm the preview shows the expected columns. Click the step above it to compare before and after.
- Rename the step if helpful. Right-click the step in Applied Steps and choose Rename, then give it a clear name such as Keep customer and order columns. This makes the query easier for others to audit.
- Reorder or delete steps if needed. Drag steps up or down in Applied Steps to change their order, or click the X beside a step to delete it. Be aware that deleting an earlier step can break later steps that depend on its output.
- Apply and close. In Excel, click Close & Load (or Close & Load To... to choose where the result lands). In Power BI Desktop, click Close & Apply. The filtered table loads into your workbook or data model.
Common Mistakes
- Filtering rows instead of columns. The filter icons on column headers filter rows by value; they do not remove columns. Use Remove Columns or Remove Other Columns to change the column set.
- Deleting a step that later steps depend on. If a later step references a column that an earlier step removed, the query errors. Check the error message and restore or reorder the step.
- Removing columns too early. If you remove a column before a merge, append, or pivot step that needs it, that step fails. Do the column cleanup after the structural steps, or keep the column until the dependent step is complete.
- Assuming the source column order is stable. Removing columns by position is fragile if the source adds or reorders columns. Removing by name, as Power Query does when you use the ribbon commands, is safer.
- Forgetting that steps are recorded. Every column removal is a step, so a query with many small removals becomes hard to read. Use Choose Columns once to select everything you need in a single step.
Tips
- Use Home > Choose Columns when you need to keep many columns or want to search the column list; it produces one clean step instead of several.
- Rename steps as you go so the Applied Steps list reads like a recipe. Future you, or a colleague, will thank you.
- If you are unsure which columns downstream steps need, duplicate the query first, experiment on the copy, and keep the original intact.
- Column removal reduces data volume, which can speed up refresh, but it does not replace row filtering. Use both: remove unneeded columns and filter out unneeded rows.
- When the source schema changes, the query may show errors on the removed-columns step. Open the step, review the preview, and adjust the selection.
Troubleshooting
If the preview shows an error such as Expression.Error: The column 'X' of the table wasn't found, a later step is referencing a column that an earlier step removed. Click the failing step, read which column is named, then either restore that column by deleting the removal step or move the removal step after the dependent step.
If Remove Other Columns is greyed out, make sure at least one column header is selected and that you are clicked into the data preview rather than the Queries pane. If the command still does not respond, close the editor without applying, reopen the query, and try again.
If the loaded table in Excel or Power BI does not match the preview, check that you applied and closed the editor rather than closing without saving. In Excel, use Data > Queries & Connections to confirm the query refreshed. In Power BI Desktop, use Refresh on the Home ribbon.
If the query is slow after many column operations, consolidate the removals into a single Choose Columns step. Fewer steps mean less work on each refresh.
Frequently Asked Questions
What is the difference between Remove Columns and Remove Other Columns?
Remove Columns deletes the columns you have selected. Remove Other Columns keeps the selected columns and deletes everything else. Both create a recorded step in Applied Steps.
Can I undo a column removal in Power Query?
Yes. Click the X beside the removal step in the Applied Steps pane to delete it, or press Ctrl+Z immediately after the action. Deleting a step does not affect the source data.
Does removing columns affect the original data source?
No. Power Query changes are applied to the query output only. The source file, database, or service is not modified unless you explicitly write changes back, which standard column removal does not do.
Why did my query break after I removed a column?
A later step, such as a merge, pivot, or calculated column, still references the removed column. Restore the column or move the removal step after the dependent step.
Can I filter columns by name pattern instead of clicking headers?
Not with the ribbon buttons alone. You can use Choose Columns with its search box to find columns by name, or write M code in the formula bar using Table.SelectColumns or Table.RemoveColumns for pattern-based selection.
Do column filters carry over when the source refreshes?
Yes. The removal is stored as a step in the query, so it reapplies on every refresh. If the source adds new columns, they will be removed by Remove Other Columns but kept by Remove Columns unless you update the step.