Smart Systems for Home

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

Power Query List Filter: How to Filter Data by List Values

· 7 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 list filter lets you retain only rows where a column’s values match items in a predefined list, making it ideal for narrowing down large datasets using dynamic criteria like product IDs, region codes, or user names. This method is more flexible than static filters and supports updating the list without rewriting queries. You need Microsoft Excel with Power Query enabled (2016 or later) or Power BI Desktop installed.

What You'll Need

  • Microsoft Excel 2016 or later (with Power Query enabled by default) or Power BI Desktop
  • A data table with at least one column containing values you want to filter by
  • A separate list of values you want to keep (e.g., a column in another sheet, a manually entered list, or a column from a different table)
  • Basic familiarity with the Power Query Editor interface

Step-by-Step

  1. Open your Excel workbook or Power BI Desktop file and load the dataset you want to filter into Power Query. To do this, select any cell in your data table, then go to the Data tab and click From Table/Range (in Excel) or Get Data > From Table/Range (in Power BI).
  2. In the Power Query Editor, identify the column you want to filter. For example, if you’re filtering sales data by region, locate the column labeled Region or similar.
  3. Prepare your filter list. If your list is in another Excel sheet, load it into Power Query using the same method: select the range, then use From Table/Range. If you’re creating a manual list, click New Source > Blank Query, then in the Formula Bar, type {"Item1", "Item2", "Item3"} and press Enter. Rename this query to something like FilterList for clarity.
  4. With your main table still open in the Power Query Editor, go to the Home tab and click Advanced Editor. Note the name of your main query (e.g., Table1).
  5. Return to the main query’s interface. Click on the column header you want to filter. From the dropdown menu, uncheck Select All, then scroll to the bottom and select Filter by List.
  6. In the Filter by List dialog box, under "Use values from a list," select the query name of your filter list (e.g., FilterList). Ensure the column name from that list is correctly referenced. If the list is a single column, Power Query will auto-detect it; if it’s a single-value list (like a list of text), make sure you’re not selecting a table with multiple columns.
  7. Click OK. Power Query will now show only rows where the selected column matches any value in your filter list. Review the results to confirm correct filtering.
  8. Click Close & Load to return the filtered data to Excel or Power BI. If you’re working in Excel, the output will appear in a new worksheet; in Power BI, it will load into the data model.
  9. To update the filter later, simply edit the FilterList query — add or remove values — then refresh the main query by right-clicking the query name in the Queries pane and selecting Refresh. The filter will automatically apply the new list.

Common Mistakes

  • Using a multi-column table as your filter list when only one column contains the target values. Power Query requires a single column of values; if your list has headers or extra columns, remove them first.
  • Typographical mismatches between the filter list and the target column. Spaces, capitalization, or special characters (like em dashes vs. hyphens) will cause mismatches. Use Text.Trim and Text.Lower in Power Query to standardize both lists before filtering.
  • Forgetting to refresh the query after updating the filter list. Changes to the FilterList query won’t take effect until you manually refresh the main query or the entire workbook.
  • Applying the filter to a column with mixed data types. If your target column contains both numbers and text, and your filter list is entirely text, Power Query may not match any values. Ensure data types match (e.g., convert both to text using As Text in the Transform tab).
  • Accidentally selecting the wrong column in the Filter by List dialog. Double-check that you’re referencing the correct column from your filter list query, not the main table’s column.

Tips

  • Use named ranges in Excel for your filter list to make it easier to update. Name the range (e.g., FilterRegion) and then reference that named range in Power Query by selecting From Table/Range — it will auto-detect the range name.
  • For dynamic lists that change often, store your filter values in a separate sheet and use Excel’s Table feature (Ctrl+T) to convert the range into a structured table. Power Query will automatically expand the list if you add new rows.
  • Test your filter with a small subset first. Create a dummy list with 3–5 values and verify the filter works before applying it to your full dataset.
  • Use the Advanced Editor to manually write the filter if needed: Table.SelectRows(Source, each List.Contains(FilterList, [ColumnName])). This gives you more control and is useful for complex logic.
  • When filtering large datasets, list-based filtering is significantly faster than multiple OR conditions. Power Query optimizes List.Contains internally.
  • Save a backup copy of your workbook before applying complex filters. While Power Query is reversible, it’s easier to revert if something goes wrong.

Troubleshooting

  • No rows appear after filtering. Check if your filter list contains any values that exactly match the target column. Use the View > Advanced Editor to inspect the values in both lists. Look for hidden characters — select a cell in your filter list, press F2, and check for trailing spaces.
  • Power Query says "The column was not found" in the Filter by List dialog. Your filter list query may have been renamed or deleted. Go to the Queries pane, confirm the filter list query still exists and is spelled exactly as shown in the dialog. If renamed, recreate the filter or edit the query in Advanced Editor.
  • Filter works in Power Query Editor but not after loading. This usually means the data type changed after loading. In Excel, right-click the column in the output table and ensure it’s formatted as Text. In Power BI, check the column data type in the Data view.
  • Filter list is too large and causes performance issues. Lists over 10,000 items can slow down filtering. Consider using a join instead (Merge Queries) if you’re matching against a large external table.
  • Filter list contains null or blank values. Power Query will treat blank as a match for blank rows. If you don’t want blanks included, filter them out of your FilterList query before using it: select the column > Transform > Remove Blank Rows.

Frequently Asked Questions

Can I filter by a list stored in another workbook?

Yes, but the other workbook must remain open. In Power Query, use Get Data > Excel and browse to the external file. Load the list as a query, then use it for filtering. If the workbook closes, the query will fail until reopened.

Does this work with numbers and dates?

Yes. The list can contain numbers, dates, or text. Ensure the data types in both the target column and the filter list match. Convert dates to text if needed, but be cautious — formatting differences (e.g., "1/1/2024" vs. "2024-01-01") can cause mismatches.

Can I use a formula to generate the filter list dynamically?

Yes. Use Power Query’s M language to create a list from a formula. For example, List.Select(Table.Column(Source, "ID"), each _ > 100) creates a list of IDs over 100. Use that list in Filter by List.

Why does my list filter sometimes show "Error" in the column?

This usually means the filter list query failed to load — perhaps due to a broken link, missing source file, or syntax error in the M code. Check the Queries pane for red error icons and fix the underlying query.

Can I filter multiple columns at once using the same list?

Not directly with Filter by List. You must apply the filter separately to each column. For efficiency, duplicate the query and apply the filter to each target column in different branches, then combine results using Append Queries.

Is there a limit to how many values can be in the filter list?

Power Query can handle lists with up to 100,000 items, but performance degrades noticeably beyond 5,000–10,000 values. For larger lists, merge the data instead of filtering.