[Excel/Power Query] Error: Formula.Firewall — Query references other queries or data sources (privacy levels prevent refresh) — How to Fix It

Summary

Formula.Firewall: Query references other queries or steps, so it may not directly access a data source appears when Power Query’s privacy engine blocks interaction between data sources or queries with different privacy levels. Power Query isolates data sources (“Public,” “Organizational,” or “Private”) to prevent unintended data exposure. When two sources with different levels are merged, appended, or cross-referenced, the firewall prevents refresh. Fixes include aligning privacy levels, enabling “Fast Combine,” or buffering intermediate queries with Table.Buffer().

Context

Power Query uses a built-in privacy isolation model. Each data source (Excel file, database, folder, or web API) gets a privacy classification. When you combine queries from different classifications (e.g., merging an internal database with a public web source), Power Query restricts the operation. This security mechanism — the Formula Firewall — ensures no data leaks between incompatible sources. However, in local or trusted environments, it often causes unnecessary blocking. To safely disable or bypass it, you can align privacy settings or use buffering techniques that break the cross-source link in memory.

Probable Cause

  • Mixed privacy levels: Combining sources classified as “Private” and “Public.”
  • Query dependency: A query references another query that accesses a different data source.
  • Disabled Fast Combine: Power Query blocked combining sources without explicit permission.
  • Moved file: File location changed, altering data source classification.
  • Cross-file merge: Combining Excel/CSV files from different folders or drives with differing privacy settings.

Quick Fix

  1. Open Privacy Settings. Power Query Editor → File → Options and Settings → Query Options → Privacy.
  2. Set consistent privacy levels. Choose either “Public,” “Organizational,” or “Private” — the same for all connected data sources.
  3. Temporarily disable the firewall. Under “Privacy,” select Ignore the Privacy Levels and potentially improve performance (only for local or trusted sources).
# Example: align privacy levels or disable checks # Excel → File → Options → Query Options → Privacy → Ignore privacy levels 
  1. Use Table.Buffer() to break privacy boundaries. Buffering copies a query’s output into memory so Power Query sees it as a single source.
# Example: buffer before merging let SourceA = Excel.Workbook(File.Contents("C:\InternalData.xlsx"), null, true), SourceB = Csv.Document(File.Contents("C:\PublicData.csv"), [Delimiter=",", Columns=5]), Buffered = Table.Buffer(SourceA{[Item="Sheet1"]}[Data]), Merged = Table.NestedJoin(Buffered, {"ID"}, SourceB, {"ID"}, "Joined", JoinKind.LeftOuter) in Merged 
  1. Check privacy in Data Source Settings. Power Query Editor → Data Source Settings → Edit Permissions → confirm that all sources share the same privacy classification.
  2. For Power BI Desktop: Enable “Fast Combine” → File → Options → Current File → Privacy → Always combine data according to your Privacy Level settings.

Full Example

Scenario: You merge a local Excel table with a CSV file from a shared network. The privacy levels are “Private” and “Organizational,” so the merge fails.

# Example that triggers Formula.Firewall SourceA = Excel.Workbook(File.Contents("C:\Users\Me\Internal.xlsx"), null, true); SourceB = Csv.Document(File.Contents("\\NetworkDrive\PublicData.csv"), [Delimiter=","]); Merged = Table.NestedJoin(SourceA, {"Key"}, SourceB, {"Key"}, "Merged", JoinKind.LeftOuter); # Error → Formula.Firewall 

Solution 1 — Align privacy levels

# Set both to Organizational Data Source Settings → Edit Permissions → Privacy Level → Organizational 

Solution 2 — Buffer one side

# Break the privacy barrier Buffered = Table.Buffer(SourceA); Merged = Table.NestedJoin(Buffered, {"Key"}, SourceB, {"Key"}, "Merged", JoinKind.LeftOuter); 

Solution 3 — Disable privacy temporarily

# Excel → File → Options and Settings → Query Options → Privacy → Ignore privacy levels 

Pitfalls & Debug

  • Symptom → “Formula.Firewall” appears when refreshing after adding a merge. Fix → Buffer or align privacy levels.
  • Symptom → Works interactively but fails on scheduled refresh. Fix → Privacy settings differ between desktop and service environment.
  • Symptom → Refresh very slow after enabling privacy. Fix → Use buffering or consolidate queries to reduce cross-source reads.
  • Symptom → Random firewall triggers after file relocation. Fix → Update file paths and reassign privacy levels.

Verification & Diagnostics

# Test buffering to isolate issue try Table.Buffer(Source) otherwise "Still isolated"
Check current privacy configuration

File → Options → Trust Center → Privacy Options → Manage Privacy Levels

Once verified, document your organization’s privacy standards: — “Public” for open datasets — “Organizational” for shared internal data — “Private” for confidential or restricted data

Security Considerations

Only disable privacy checks if:

  • All data sources are local and trusted.
  • No personal, financial, or external-sensitive data is being combined.
  • You understand that disabling privacy removes cross-source isolation.

Sources

Microsoft Docs — Power Query Privacy Levels

Handling the Formula Firewall

Table.Buffer (Power Query M)

Labels

Tool/Power Query, OS/Cross-platform, Topic/Privacy Levels & Firewall Isolation