New: free Power BI model health check. Find what's making your numbers wrong and your model slow. Check your model →
← Back to Blog

Power Query Error: Formula.Firewall (Rebuild This Data Combination)

Formula.Firewall comes in two versions. "References other queries or steps, so it may not directly access a data source" is about how the query is structured; "privacy levels which cannot be used together" is about privacy levels. Here's how to tell them apart and fix each one properly.

Power QueryTroubleshooting

The firewall error comes in two versions, and they need different fixes:

Formula.Firewall: Query 'Orders' (step 'Added Custom') references other queries or steps,
so it may not directly access a data source. Please rebuild this data combination.
Formula.Firewall: Query 'Orders' (step 'Merged Queries') is accessing data sources that have
privacy levels which cannot be used together. Please rebuild this data combination.

Both come from Power Query's data privacy firewall, which exists to stop data from one source leaking into a request to another: a customer list from your database ending up in the URL of a call to a public web API, for example. The first message is about how the query is built. The second is about privacy levels. Read which one you have before changing anything.


How the Firewall Sees a Query

When the firewall is on, Power Query splits your queries into partitions: groups of steps, as small as a single step. Then it applies one rule, described in Microsoft's data privacy firewall documentation:

A partition may either access compatible data sources, or reference other partitions, but not both.

When a partition references another, the firewall acts as the gatekeeper for the data passing between them, checking privacy levels on the way. It can't do that if the same partition is also calling a data source directly, so it refuses: that's the first message.


Version 1: "References Other Queries or Steps"

This is a structure problem. Some step reads a data source and uses another query's output in the same place. The classic case is a lookup per row:

// Query: Orders
let
    Source = Sql.Database("sql01", "Sales"),
    Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data],
    #"Added Custom" = Table.AddColumn(Orders, "Rate", each GetRate([Currency]))
in
    #"Added Custom"

GetRate is another query, a function that calls a currency API with Web.Contents. The Orders query reads SQL Server directly and, in the same step chain, calls GetRate with values from that data. That's both, so the firewall stops it.

Other common shapes:

  • A filter that uses a value from another query: Table.SelectRows(Source, each [Region] = SelectedRegion) where SelectedRegion comes from a table in Excel.
  • A file path or URL built from another query's output: Excel.Workbook(File.Contents(FolderQuery{0}[Path])).
  • A merge between a source step and another query inside the same query.

Setting privacy levels doesn't fix this version. The query has to be restructured.

Fix: Separate Reading From Combining

Give each source its own query, and do the combining in a query that only references other queries:

// Query: Orders (reads SQL only)
let
    Source = Sql.Database("sql01", "Sales"),
    Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data]
in
    Orders
// Query: Rates (reads the API only, for a fixed list of currencies)
let
    Currencies = {"EUR", "GBP", "JPY"},
    AsTable = Table.FromList(Currencies, Splitter.SplitByNothing(), {"Currency"}),
    WithRate = Table.AddColumn(AsTable, "Rate", each GetRate([Currency]))
in
    WithRate
// Query: Orders with Rates (references only, reads no source itself)
let
    Merged = Table.NestedJoin(Orders, {"Currency"}, Rates, {"Currency"}, "R", JoinKind.LeftOuter),
    Expanded = Table.ExpandTableColumn(Merged, "R", {"Rate"})
in
    Expanded

The rate lookup no longer depends on the Orders data, and the final query only references other queries. Turn off Enable load on the two staging queries; see Reference vs. Duplicate Queries.

If the values really must come from the other source, for example the list of currencies is only known from Orders, the alternative is the opposite: put every source access in one query, so it's a single partition. Inline the steps rather than referencing a separate query.


Version 2: "Privacy Levels Which Cannot Be Used Together"

This one is about privacy levels. Each source has one: Public, Organizational, Private, or unset. Sources combined in the same partition must be compatible: both Public, or both Organizational. Private data can't be combined with other sources.

Fix: set accurate levels. In Power BI Desktop: File → Options and settings → Data source settings, select each source, Edit Permissions, and set the Privacy Level. Two internal systems are usually both Organizational. Don't mark internal data Public to make the error go away: that tells Power Query it's safe to send that data anywhere.

In the Power BI Service, privacy levels are set per data source along with its credentials, in the semantic model's settings or on the gateway connection. Check them there too if refresh fails only after publishing.


"Always Ignore Privacy Level Settings"

Power BI Desktop has an option, File → Options and settings → Options → Current file → Privacy → Always ignore Privacy Level settings (it also appears under Global). It turns the firewall off, which makes both messages disappear and can also make combining queries faster.

Use it only when every source is trusted. And test scheduled refresh in the Service before relying on it: there, privacy levels are set per data source with its credentials, so a report that only works with the firewall off in Desktop may behave differently after publishing.

Common Mistakes

Changing privacy levels to fix the "references other queries" version. It's a structure problem; privacy levels don't touch it.

Marking everything Public. It silences version 2 by declaring confidential data safe to share.

Assuming the query is broken because it worked yesterday. A new merge, filter, or custom column is often the first step that combines two partitions.

Fixing one query and moving on. The error names one step, but every query that mixes reading and combining the same way will hit it.

Next Steps

FAQ

+What does Formula.Firewall mean in Power Query?

Power Query's data privacy firewall stopped a query because it couldn't guarantee that data from one source wouldn't be sent to another. There are two versions of the message: one about the query's structure (a step that both reads a data source and uses another query) and one about privacy levels that can't be combined.

+How do I fix "references other queries or steps, so it may not directly access a data source"?

Restructure so that no single step both reads a data source and uses the result of another query. Usually that means giving each source its own query, and doing the combining (merge, lookup, or filter) in a query that only references those queries. Setting privacy levels doesn't fix this version.

+How do I fix "privacy levels which cannot be used together"?

Set accurate privacy levels on each source in Data source settings. Sources that are both Organizational, or both Public, can be combined; Private data can't be combined with other sources.

+Should I just turn on "Always ignore Privacy Level settings"?

Only for sources you fully trust, and only knowing what it does: it turns the firewall off in Desktop. Test scheduled refresh in the Service before relying on it, because privacy levels there are set per data source with its credentials.