Fixing the Power Query Formula.Firewall Error: A Step-by-Step Guide

intermediate📊 Microsoft Excel2026-04-29| Microsoft Excel (Microsoft 365, 2021, 2019, 2016) on Windows 10/11 or macOS.

Error Message

Formula.Firewall: Query 'QueryName' (step 'StepName') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.
#power-query#data-privacy#excel-error

The Error Message

You’ve built your queries and you're ready to merge the data, but Excel stops you with a cryptic message. It usually looks like this:

Formula.Firewall: Query 'SalesData' (step 'Source') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

It’s a frustrating roadblock, but it exists for a good reason. Let’s look at why it happens and how to get past it.

Why This Error Occurs

Power Query uses a "Data Privacy Firewall" to protect your information. Think of it as a security guard. Its job is to prevent data from a private source—like a local CSV file on your desktop—from being accidentally leaked to a public source, such as a Web API or a SQL Server.

The error triggers when one query depends on another query to define its data source. For example, if you use a value from Table A to filter Table B, Power Query might block the "mashup" because it can't guarantee that Table A's data won't be sent over the network during the process. This is common when merging a small local table with a massive cloud database containing over 100,000 rows.

Fix 1: Adjust Privacy Level Settings (The Fast Path)

If you trust your data sources and aren't worried about data leaking between them, you can simply tell Excel to look the other way. This is the most common fix for internal projects.

  • In Excel, navigate to the Data tab and select Get Data > Query Options.
  • Look at the left sidebar. Under the Current Workbook section, click Privacy.
  • Select Ignore the Privacy Levels and potentially improve performance.
  • Hit OK and Refresh your query.

Keep in mind that this setting is specific to the workbook. If you email this file to a colleague, they will likely encounter the same error until they change their own settings.

Fix 2: Align Your Privacy Levels

If you prefer to keep the firewall active, make sure all your data sources share the same privacy designation.

  • Go to Data > Get Data > Data Source Settings.
  • Pick a data source and click Edit Permissions.
  • Set the Privacy Level to "Organizational" for everything.
  • Repeat this for every source in the query and refresh.

Fix 3: Restructure Your M Code (The Pro Approach)

Corporate policies sometimes forbid disabling privacy settings. In these cases, you must change how your queries are built. The firewall usually hates it when a single step tries to pull external data using a variable it just calculated from a different source.

The Problematic Code

let
    // Grabbing an API key from a local Excel table
    SourceKey = Excel.CurrentWorkbook(){[Name="Config"]}[Content]{0}[Key],
    
    // Trying to use that key to fetch web data in the same query
    // This triggers the Firewall error!
    Data = Json.Document(Web.Contents("https://api.example.com/v1/" & SourceKey))
in
    Data

The Corrected Strategy

The best way to fix this is to use Staging Queries. Create one query to get your API key or filter criteria. Then, create a second, independent query to fetch the raw data. Finally, create a third query that merges the two. This separation tells Power Query that the data fetch is independent of the calculation, clearing the firewall check.

Alternatively, you can use Table.Buffer(). Wrapping a step in Table.Buffer forces Power Query to load that data into memory completely before moving to the next step, which often breaks the link that the firewall is worried about.

Verification Steps

You’ll know you’ve succeeded when:

  • The Power Query Editor preview loads without the red error bar.
  • Clicking Refresh Preview displays all 50 columns of your data instantly.
  • Close & Load successfully populates your Excel sheet with the merged results.

Prevention Tips

  • Stage your data: Always pull raw data into separate queries before performing merges or joins.
  • Avoid dynamic headers: Try not to build your URL or SQL connection string using logic from another table within the same query.
  • Validate your inputs: If you are merging data for networking tasks, like mapping IP ranges, double-check your logic first. I use the Subnet Calculator on ToolCraft to verify CIDR blocks before importing them into my Excel config. It’s a fast browser tool that doesn’t upload your data, which keeps the "Data Privacy Firewall" in your head happy too.

Related Error Notes