In Power BI, what causes Power Query's Formula.Firewall error and how do you fix it?
answer
- it is a refusal, not a bug
- one query cannot both connect and reference
- private, organizational, public
- laptop refreshes, gateway does not
- turning it off is not free
basics
~20 sPower Query's data privacy firewall blocks combinations where a value from one source could leak into a query sent to another. It fires when a query both references other queries and touches a source directly, or when combined sources have incompatible privacy levels.
solid answer
~60 sPower Query evaluates data combinations under a **privacy firewall** whose job is to stop a value from one source being embedded in a query sent to a different source — for instance folding a filter built from a confidential spreadsheet into SQL sent to an external database. Two messages result. `Query 'X' (step 'Y') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.` means one query is doing both jobs; the fix is to split it into a *source* query that only connects and a *transform* query that references it, so each partition either touches a source or combines results, never both. The other message says the sources' **privacy levels** — Private, Organizational, Public, or None — cannot be used together; the fix is to set compatible levels on the data sources, in Desktop and again wherever the refresh runs, such as the gateway. Desktop can ignore privacy levels for a file, which restores the refresh but removes the protection.
code
powerquery · 8 lines// refused: this query both reads a value from another query
// and passes it into a data source connection
let
Server = ConfigQuery{0}[ServerName],
Source = Sql.Database(Server, "sales"),
Orders = Source{[Schema="dbo",Item="Orders"]}[Data]
in
Ordersgo deeper
Know the error exists and that it comes from Power Query's privacy settings, not from a broken connection or bad credentials.
Explain the partition rule — a query may access a source or reference other queries, not both — and the four privacy levels and what combining them means.
Restructure a failing model into source and transform queries, and diagnose the case where Desktop refreshes but the gateway does not because privacy levels were never set there.
Own the policy: what gets classified Private versus Organizational across the estate, when ignoring privacy levels is acceptable, and when the real answer is to co-locate the data upstream.
## What the firewall is protecting against Power Query folds work into sources wherever it can. That is normally what you want — but it means a value from one source can end up *inside a query text sent to another source*. Filter a customer list from a confidential HR workbook and merge it against an external vendor's database, and a folded implementation could send those confidential names to the vendor's server in a `WHERE … IN (…)` clause. Nothing malicious happened; the optimiser simply did its job. The **data privacy firewall** exists to prevent exactly that. It analyses how queries reference one another before evaluation and refuses combinations it cannot prove safe. Its errors are therefore not bugs but refusals, which is why "just retry" never helps. ## The two messages, which have different causes **The partition message.** *"Query 'X' (step 'Y') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination."* This one has nothing to do with which privacy levels you chose. The firewall splits evaluation into partitions and requires each partition to be one of two kinds: a partition that *accesses a data source*, or a partition that *references other queries*. A single query that does both — connects to SQL Server and also feeds a parameter value taken from another query into that connection — cannot be classified, and is refused. The fix is structural, and it is a good habit regardless of the firewall: split the query in two. - A **source query** that does nothing but connect and return raw data. - A **transform query** that references the source query and does all the shaping and combining. When the offending value is a parameter fed into a connection (a server name, a date bound, an API path assembled from another query), promote it to a real Power Query parameter rather than reading it out of a query mid-flight. **The privacy-level message.** *"Formula.Firewall: Query 'X' is accessing data sources that have privacy levels which cannot be used together."* Each data source gets a privacy level: **Private** (never shared with any other source), **Organizational** (shareable with other Organizational sources but not Public ones), **Public**, or **None** (not yet classified). Combining a Private source with anything else is refused by design. The fix is to classify the sources honestly — usually marking internal databases and internal file shares Organizational so they may be combined with each other — rather than reflexively marking everything Private. ## Where the settings live matters as much as what they are Privacy levels are stored per data source, per environment. Setting them in Power BI Desktop fixes your local refresh and does nothing for the Service: a scheduled refresh through an on-premises data gateway evaluates the same combination on the gateway host, under the privacy levels configured for that gateway's data sources. A report that refreshes perfectly on a laptop and fails in the Service with a firewall error is the signature of this mismatch, and it is the version of the problem that reaches production. Power BI Desktop also offers, per file, an option to ignore privacy levels and combine sources anyway. It genuinely resolves the error and it genuinely removes the protection — the potential leak the firewall was preventing becomes possible. Use it knowingly, on sources where cross-source exposure carries no consequence, and never as a default reflex on a file touching regulated data. ## The performance angle nobody mentions first Even when the firewall permits a combination, enforcing privacy can be expensive: to guarantee no value crosses, the engine may buffer data locally rather than let a filter fold into the other source. So a combination that squeaks past the firewall can also be dramatically slower than the same logic would be with both datasets in one source. That is a further argument for the structural answer: if the two datasets need to be joined routinely, land them in the same warehouse and join them there, so Power Query reads one already-combined source and never has to reason about crossing at all. ## How to approach it in an interview Say what the firewall is for before saying how to silence it. The strong answer is: understand which two sources are being combined; restructure into source-plus-transform queries so no partition both connects and references; classify privacy levels deliberately and set them wherever the refresh actually runs; and treat "ignore privacy levels" as an informed exception rather than the fix. The weak answer is "turn off privacy levels", which is also, unfortunately, the most common one on the internet.
- Why does a report refresh fine in Power BI Desktop but hit a firewall error in the Service?Privacy levels are configured per environment. Desktop stores them for your machine; a scheduled refresh evaluates the same combination on the gateway host or in the cloud, under the privacy levels set for that data source there. Until you classify the sources where the refresh actually runs, the Service sees an unclassified or incompatible combination and refuses it.
- What is the real risk of enabling the option to ignore privacy levels?It permits exactly the leak the firewall prevents: a value from one source can be embedded in a query sent to another — a confidential list of names folded into a WHERE clause against an external database. On sources with no confidentiality implications that is harmless; on regulated data it converts a refusal into an undetected disclosure.
- Beyond the error, how do privacy levels affect refresh performance?Enforcing them can prevent a filter from folding into the other source, forcing Power Query to buffer data locally and combine it in the mashup engine. So a permitted combination may still be far slower than the same join would be inside one source — another reason to land both datasets in the warehouse and let the database do the join.
It is a security guard who will not let you carry documents from one office into another — not because the documents are wrong, but because he cannot see what you would do with them once inside.
saying these in an interview costs you the question
- Treats the firewall error as a bug to be retried
- Turning off privacy levels as the default fix
- Believes Desktop privacy settings carry over to the gateway
- Confuses privacy levels with row-level security
- Cannot explain what value the firewall is preventing from leaking