The Power Query Formula Firewall is a security mechanism that prevents data from one source from being leaked to another source during a query execution. You encounter the "Formula.Firewall" error when a query attempts to combine data from two or more sources with different privacy levels, such as combining a private local Excel file with a public web API. To resolve this, you must either align the privacy levels of all involved data sources or disable the privacy levels check in the global settings.
What You'll Need
- Microsoft Excel or Power BI Desktop installed on your machine.
- A Power Query workbook or report that is currently triggering a Formula.Firewall error.
- Administrative access to the application settings to modify privacy levels.
- An understanding of which data sources are being used (e.g., SQL Server, Web, CSV, SharePoint).
Step-by-Step
Depending on whether you want to maintain security or prioritize speed of development, there are two primary ways to handle the Formula Firewall error. Note that menu labels may differ slightly based on your software version or region.
Method 1: Aligning Privacy Levels (The Secure Way)
- Open your workbook or report and navigate to the Data tab in the ribbon.
- Select Get Data and then choose Data Source Settings from the dropdown menu.
- In the Data Source Settings window, you will see a list of all sources currently connected to your file. Select the first data source involved in your failing query.
- At the bottom of the window, look for the Privacy Level dropdown. Select a level (Public, Organizational, or Private). For example, if the data is from an internal company server, select Organizational.
- Repeat this process for every other data source involved in that specific query. Ensure they are all set to the same level (e.g., all set to Organizational).
- Click Close and then attempt to Refresh your query.
Method 2: Ignoring Privacy Levels (The Fast Way)
- In Excel, go to the Data tab, select Get Data, and click Query Options. In Power BI, go to File > Options and settings > Options.
- In the Options dialog box, locate the Global section in the left-hand sidebar.
- Click on Privacy.
- Under the "Privacy Levels" section, select the radio button labeled Ignore the Privacy Levels and potentially improve performance.
- Click OK to save the changes.
- Return to the Power Query Editor and refresh your data. The Formula.Firewall error should now be gone.
Method 3: Restructuring the Query (The Professional Way)
- Identify the step in your query where the firewall error occurs. This usually happens during a Merge or Join operation between two different sources.
- Create a separate query for each data source. For example, create "Query_SourceA" for your SQL database and "Query_SourceB" for your local Excel file.
- Ensure both queries are loaded as "Connection Only" (right-click the query in the Queries pane and uncheck Enable Load).
- Create a third query that references the first two. Use the
= SourceAand= SourceBsyntax to pull the data into the final query. - Perform the Merge or Join operation within this third query. By separating the data retrieval from the data transformation, you often bypass the firewall's strict evaluation of a single query's data flow.
Common Mistakes
One of the most frequent mistakes is assuming that setting all sources to "Public" is the best solution. While this often stops the error, it means that if you publish the report to a cloud service, the system may treat your internal data as public, which can lead to security vulnerabilities. Always use "Organizational" for internal company data.
Another common error is ignoring the difference between Global and Current File settings. Users often change the privacy levels for the current file but forget that a new file will revert to the Global settings. If you are building a template for other users, you cannot rely on their Global settings; you must ensure the data source levels are defined within the file or that the data is structured to avoid the firewall.
Many users also try to fix the error by simply deleting and recreating the query. This rarely works because the Formula Firewall is not caused by a "bug" in the query logic, but by a security policy regarding how data moves between different security zones. Until the privacy levels are aligned or ignored, the error will persist regardless of how many times the query is rewritten.
Tips
To avoid these errors from the start, try to consolidate your data sources. If you can move your local Excel files into a SharePoint folder or a SQL table, you only have one data source (the cloud or the server), which eliminates the need for the firewall to mediate between different privacy zones.
When using Method 3 (restructuring), use the Buffer function. Wrapping a source in Binary.Buffer or Table.Buffer can sometimes force Power Query to load the data into memory before performing the join. This prevents the engine from trying to "fold" the query back to the source in a way that violates privacy rules, effectively silencing the firewall error while maintaining better performance.
Always document which privacy settings you changed. If you choose to "Ignore Privacy Levels," make a note in the workbook documentation. If a different colleague opens the file on a machine where privacy levels are strictly enforced, the query may fail for them even if it works for you.
Troubleshooting
If you have aligned the privacy levels to "Organizational" but the Formula.Firewall error still appears, check for "Dynamic Data Sources." This happens when the URL or file path of a source is determined by a value in another query. Power Query cannot determine the privacy level of a source until the query actually runs, which triggers the firewall. To fix this, try to hard-code the source path or use a Parameter instead of a dynamic cell value.
If the "Ignore Privacy Levels" option is greyed out, it is likely because your organization has implemented a Group Policy (GPO) that enforces data privacy settings at the system level. In this case, you will need to contact your IT administrator to request a change in the security policy for Power BI or Excel.
If your query is suddenly running very slowly after you fixed the firewall error, it is likely because you disabled "Query Folding." When you ignore privacy levels or use Table.Buffer, the Power Query engine can no longer push the filtering and joining logic back to the server (SQL). You may need to optimize your filters to happen as early as possible in the query steps to reduce the amount of data being pulled into your local memory.
Frequently Asked Questions
What exactly is the Power Query Formula Firewall?
It is a security layer that prevents data from a "Private" source from being sent to a "Public" source. For example, it stops a query from taking a private customer list and sending those names as parameters to a public web API, which would leak private data to the web.
Does ignoring privacy levels make my computer vulnerable?
It does not make your OS vulnerable to viruses, but it does mean that Power Query will not warn you if you accidentally send sensitive data from one source to another. It is a data leakage risk, not a system security risk.
Why does this error only happen sometimes?
The error only triggers when you combine data from two different sources in a single query. If you have five different queries that each pull from one source, you will never see this error. It only appears during Merges, Joins, or when using a value from one source as a filter for another.
Can I fix the Formula Firewall error for everyone who opens my file?
Not entirely. Privacy levels are often stored in the user's local profile. While you can set the levels for the current file, if the recipient has "Always Ignore" turned off in their Global settings and the sources are mismatched, they may still see the error. The best fix is to restructure the query to be firewall-compliant.
Is there a difference between "Organizational" and "Private"?
Yes. "Private" is the most restrictive and is intended for data that should never be shared with any other source. "Organizational" allows data to be shared with other sources that are also marked as Organizational, making it the ideal setting for company-wide reports.