Smart Systems for Home

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

Power Query Editor Add Filter: 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

To add a filter in the Power Query Editor, click the drop-down arrow in the header of the column you want to filter, uncheck the values you wish to remove (or select specific criteria), and click OK. This process removes unwanted rows from your dataset, ensuring that only the relevant information is loaded into your final report or table.

What You'll Need

  • Microsoft Excel or Power BI Desktop installed.
  • A data source already connected and loaded into the Power Query Editor window.
  • Basic understanding of which column contains the criteria you need to filter by.

Step-by-Step

  1. Open the Power Query Editor. If you are in Excel, go to the Data tab and select Get Data > Launch Power Query Editor. If you are in Power BI, click Transform Data from the Home ribbon.
  2. Locate the column you wish to filter. Note that labels and menu options may differ slightly depending on your software version or region.
  3. Click the filter icon (a small downward-pointing arrow) located on the right side of the column header.
  4. Choose your filtering method from the resulting menu:
    • Basic Filtering: A list of all unique values in that column appears with checkboxes. Uncheck the values you want to exclude, or uncheck "Select All" and check only the values you want to keep.
    • Text Filters: If the column is a text type, hover over Text Filters to find options like "Equals," "Does Not Equal," "Begins With," or "Contains."
    • Number Filters: If the column is a numeric type, hover over Number Filters to find options like "Greater Than," "Less Than," or "Between."
    • Date Filters: If the column is a date type, hover over Date Filters to access options like "In the last 30 days" or "Year-to-date."
  5. After selecting your checkboxes or defining your logic in the filter dialog box, click OK.
  6. Observe the Applied Steps pane on the right side of the screen. You will see a new step added called "Filtered Rows." This confirms that the filter has been applied to the data pipeline.
  7. To apply the changes to your worksheet or report, click Close & Apply (Power BI) or Close & Load (Excel) in the top-left corner of the ribbon.

Common Mistakes

  • Filtering before Data Type Assignment: Trying to use "Number Filters" on a column that Power Query still recognizes as "Any" or "Text." Always ensure your data types are correctly set (e.g., Decimal Number, Date) before applying advanced filters.
  • Over-filtering: Removing too many rows early in the process, which may lead to missing data in later steps of your data transformation.
  • Case Sensitivity: Forgetting that Power Query is case-sensitive. Filtering for "Apple" will not include "apple" or "APPLE" unless you transform the column to lowercase or uppercase first.
  • Ignoring the Applied Steps: Forgetting that filters are recorded as steps. If you change a filter later, you must edit the specific "Filtered Rows" step rather than adding a second filter to the same column, which can slow down performance.

Tips

  • Use "Does Not Equal": When you only want to remove one specific value (like "Null" or "Error") from a list of thousands, use the "Does Not Equal" text/number filter instead of unchecking one box in a massive list.
  • Combine Filters: You can apply filters to multiple columns. Power Query will process these sequentially, narrowing your dataset further with each additional filtered column.
  • Dynamic Filtering: Use the "Between" or "Greater Than" options for dates and numbers to ensure your report remains dynamic as new data is added to the source.
  • Rename Steps: Right-click the "Filtered Rows" step in the Applied Steps pane and select Rename to give it a descriptive name, such as "Filter Out Cancelled Orders."

Troubleshooting

If the filter does not seem to work or the data is not updating as expected, try these steps in order:

  1. Refresh the Preview: Click the Refresh Preview button in the Home tab to ensure you are seeing the most current version of the source data.
  2. Check Data Types: Look at the icon to the left of the column header. If it says "ABC/123," it is set to "Any." Change it to the specific type (Text, Whole Number, etc.) and re-apply the filter.
  3. Inspect the Formula Bar: Look at the formula bar at the top (if not visible, go to the View tab and check Formula Bar). Ensure the M-code correctly reflects the value you are filtering for.
  4. Remove and Re-apply: Click the X next to the "Filtered Rows" step in the Applied Steps pane to remove the filter entirely, then apply it again from scratch.

Frequently Asked Questions

Can I filter for multiple values at once?

Yes. In the basic filter list, you can check as many boxes as you like. If using advanced filters, you can use "Or" logic within the filter dialog to include multiple criteria.

Will filtering in Power Query delete data from my original source file?

No. Power Query is a non-destructive tool. It only filters the data as it is being loaded into the destination; your original Excel file or database remains untouched.

What is the difference between a filter in Power Query and a filter in an Excel Table?

Power Query filters happen during the data loading process (ETL), meaning the unwanted data never even reaches your spreadsheet. Excel Table filters only hide rows that are already loaded into the sheet.

How do I remove a filter I previously added?

Go to the Applied Steps pane on the right and click the X icon next to the "Filtered Rows" step. This will instantly restore the removed data.

Can I filter for blank cells?

Yes. In the filter drop-down menu, look for (Blank) or null at the bottom of the list and uncheck it to remove empty rows.