Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Filter Function: How to Filter Data

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Power Query's filter function is not a single function but a set of filtering tools: the filter dropdowns on column headers, the Filter Rows dialog, and the Table.SelectRows function in the M language. The quickest way to filter is to click the filter arrow on a column header and choose values or conditions. For repeatable, logic-based filtering, use Table.SelectRows in a custom column or the formula bar. This guide shows both methods, plus how to avoid the most common mistakes.

What You'll Need

  • Power Query available in Excel (Data > Get & Transform Data) or Power BI Desktop (Transform Data).
  • A table or data source already loaded into the Power Query Editor.
  • Basic familiarity with the Power Query Editor ribbon and the Applied Steps pane.

Step-by-Step

  1. Load your data into Power Query. In Excel, select your table and go to Data > From Table/Range. In Power BI, use Home > Transform Data to open the Power Query Editor. The exact labels can differ slightly by version, device or region.
  2. Filter with the column header dropdown (simplest method). Click the filter arrow on the column you want to filter. Untick (Select All), tick the values you want, and click OK. For text columns you can use Text Filters > Contains, Begins With, or Equals. For numbers, use Number Filters > Greater Than or Less Than. For dates, use Date Filters such as Between or In the Previous.
  3. Filter with the Filter Rows dialog (multi-condition). Go to Home > Filter Rows. In the dialog, choose a column, an operator (Equals, Does Not Equal, Contains, etc.), and a value. Click Add clause to combine conditions with AND/OR logic. This is useful when you need to filter on multiple columns at once.
  4. Filter with Table.SelectRows (M formula method). Select the step before your filter in the Applied Steps pane. Then open the formula bar (View > Formula Bar) and wrap your table reference in Table.SelectRows. For example, to keep rows where the Status column equals "Active":
    Table.SelectRows(PreviousStep, each [Status] = "Active")
    Replace PreviousStep with the actual name of the prior step. The each keyword tells Power Query to evaluate the condition for every row.
  5. Combine conditions in Table.SelectRows. Use and or or inside the expression. For example, to keep rows where Status is "Active" and Amount is greater than 100: Table.SelectRows(PreviousStep, each [Status] = "Active" and [Amount] > 100) For text contains, use Text.Contains([Column], "text") . For date ranges, use .
  6. Check the Applied Steps pane. Each filter adds a step. You can click any step to preview the data at that point, rename steps, or delete a step to undo the filter. Steps run in order, so a filter added later applies to the already-filtered result.
  7. Close and load. When finished, click Home > Close & Load (Excel) or Home > Close & Apply (Power BI) to apply the filters to your output table.

Common Mistakes

  • Forgetting that filters are case-sensitive in some contexts. Text comparisons in M are case-sensitive by default. Use Text.Lower([Column]) = "active" if case varies.
  • Using the wrong step reference. In Table.SelectRows, the first argument must be the exact name of the previous step, not the table name. Check the Applied Steps pane.
  • Filtering after a column rename. If you rename a column, any later filter step that references the old name will break. Update the step or reorder the steps.
  • Assuming filters are dynamic. A filter set via the dropdown is fixed to the values you selected. If new values appear in the source, they will be excluded unless you use a condition-based filter (e.g., Text Filters > Contains) or Table.SelectRows with logic.
  • Filtering on a column that contains errors or nulls. Errors can cause the filter to fail. Clean or replace errors before filtering.

Tips

  • Use Remove Empty or Remove Errors before filtering to avoid unexpected results.
  • For reusable filters, write them in Table.SelectRows so they adapt to new data.
  • Rename your filter steps to something meaningful (e.g., "Filter Active Customers") for easier maintenance.
  • Use View > Column Quality to see the distribution of values before filtering.
  • To filter on multiple values from a list, use List.Contains inside Table.SelectRows: Table.SelectRows(PreviousStep, each List.Contains({"A","B"}, [Column])).

Troubleshooting

  • Filter step shows an error: Check the formula for typos, missing brackets, or wrong step names. Click the error to see details.
  • No rows returned: Verify the filter condition matches the data type (text vs. number). For example, [Amount] > 100 fails if Amount is text.
  • Filter doesn't update with new data: The dropdown filter is static. Replace it with a condition-based filter or Table.SelectRows.
  • Filter breaks after source change: If column names change, update the filter step. Use Advanced Editor to inspect the M code.
  • Performance slow with large data: Filter early in the steps to reduce rows before other transformations. Avoid complex custom filters if simpler ones work.

Frequently Asked Questions

Can I filter with multiple conditions using the dropdown?

Yes, but only within one column at a time. For conditions across multiple columns, use Filter Rows or Table.SelectRows.

What is the difference between filtering and removing rows?

Filtering keeps rows that match a condition; removing rows deletes specific rows (e.g., top N, duplicates). Both are in the Home tab.

How do I filter for blanks or nulls?

In the dropdown, untick (Select All) and tick (null) or (blank). In M, use [Column] = null or [Column] = "".

Can I use wildcards in Power Query filters?

Yes, in text filters like Contains you can use * and ? in some versions, but for reliability use Text.Contains or Text.StartsWith in M.

Why does my filter show fewer rows than expected?

Check for leading/trailing spaces, case differences, or data type mismatches. Use Trim and Clean transformations first.

Does filtering in Power Query affect the original data source?

No. Power Query filters only the loaded copy; the source remains unchanged.