Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jmillsjmills
Helper III
Helper III

Formula.Firewall Error - Can't Set Privacy Levels to Ignore

I have a query that returns: "Formula.Firewall: Query 'msciData' (step 'Changed Type') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination."
 
It works fine with privacy levels set to ignore. And this only happens with the privacy levels for all sources switched to "Organisational", and the main setting set to "Combine privacy levels across data sources". Even though I know I can just switch these privacy levels to ignore so it works fine in desktop mode, I'm being told by an engineer that privacy levels cannot be ignored when running a scheduled refresh of the dataset within the online Power BI data service. (Does everyone agree with that claim?)
 
What am I doing wrong with the following code for it to return the above? It's telling me to rebuild my data combination but I very often use this approach of building a custom function to loop a several strings into parameter through a URL.
 
My custom function is:
let
#"Table" = (date_column,index_style,index_size,index_market,index_scope) as table =>
let
Source = Csv.Document(Web.Contents("https://app2.msci.com/products/", [RelativePath="service/index/indexmaster/description/indexes?calc_date="&date_column&"&index_variant=NETR&currency_symbol=GBP&index_market="&index_market&"&index_scope="&index_scope&"&index_size="&index_size&"&index_style="&index_style&"&index_suite=C"]),[Delimiter=",", Columns=11, Encoding=1252, QuoteStyle=QuoteStyle.None]),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"MSCI Index", type text}, {"Index Code", Int64.Type}, {"Last", type text}, {"Day", Percentage.Type}, {"MTD", Percentage.Type}, {"3MTD", Percentage.Type}, {"YTD", Percentage.Type}, {"1 Yr", Percentage.Type}, {"3 Yr", Percentage.Type}, {"5 Yr", Percentage.Type}, {"10 Yr", type text}})
in
#"Changed Type"
in
#"Table"
 
And the main query is:
 
let
market = Source[market],
#"Converted to Table" = Table.FromList(market, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "name"}, {"id", "name"}),
index_market = Table.SelectRows(#"Expanded Column1", each ([id] <> "China Markets" and [id] <> "GCC and Arabian Markets"))[id],
Custom1 = Source,
size = Custom1[size],
#"Converted to Table1" = Table.FromList(size, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column2" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"id", "name"}, {"id", "name"}),
index_size = Table.SelectRows(#"Expanded Column2", each ([name] = "Large Cap" or [name] = "Micro Cap" or [name] = "Mid Cap" or [name] = "Small Cap" or [name] = "Standard (Large+Mid Cap)"))[id],
Custom2 = Source,
style = Custom2[style], #"Converted to Table2" = Table.FromList(style, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
index_style = Table.ExpandRecordColumn(#"Converted to Table2", "Column1", {"id", "name"}, {"id", "name"})[id], Custom3 = {"Region","Country"},
#"Converted to Table3" = Table.FromList(Custom3, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Added Custom" = Table.AddColumn(#"Converted to Table3", "IndexMarket", each index_market),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "IndexMarket"),
Custom4 = Table.AddColumn(#"Expanded Custom", "IndexSize", each index_size),
#"Expanded IndexSize" = Table.ExpandListColumn(Custom4, "IndexSize"),
Custom5 = Table.AddColumn(#"Expanded IndexSize", "IndexStyle", each index_style),
#"Expanded IndexStyle" = Table.ExpandListColumn(Custom5, "IndexStyle"),
#"Added Custom1" = Table.AddColumn(#"Expanded IndexStyle", "Date", each fundReturnDate),
#"Merged Queries" = Table.NestedJoin(#"Added Custom1", {"Column1", "IndexMarket", "IndexSize", "IndexStyle"}, msciToExclude, {"Column1", "IndexMarket", "IndexSize", "IndexStyle"}, "msciToExclude", JoinKind.LeftOuter),
#"Expanded msciToExclude" = Table.ExpandTableColumn(#"Merged Queries", "msciToExclude", {"Column1"}, {"Column1.1"}), #"Filtered Rows1" = Table.SelectRows(#"Expanded msciToExclude", each ([Column1.1] = null)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows1",{"Column1.1"}),
#"Invoked Custom Function" = Table.AddColumn(#"Removed Columns", "data", each msciPull([Date], [IndexStyle], [IndexSize], [IndexMarket], [Column1])),
#"Expanded data" = Table.ExpandTableColumn(#"Invoked Custom Function", "data", {"MSCI Index", "Index Code", "Last", "Day", "MTD", "3MTD", "YTD", "1 Yr", "3 Yr", "5 Yr", "10 Yr"}, {"MSCI Index", "Index Code", "Last", "Day", "MTD", "3MTD", "YTD", "1 Yr", "3 Yr", "5 Yr", "10 Yr"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded data", each ([MSCI Index] <> null)),
#"Changed Type" = Table.TransformColumnTypes(#"Filtered Rows",{{"MTD", Percentage.Type}, {"3MTD", Percentage.Type}, {"YTD", Percentage.Type}, {"1 Yr", Percentage.Type}, {"3 Yr", Percentage.Type}, {"5 Yr", Percentage.Type}, {"10 Yr", Percentage.Type}}) in #"Changed Type"
1 REPLY 1
Anonymous
Not applicable

Hi @jmillsjmills ,

Try flatten your queries. This means each query should pull all the information it needs from each data source.
excel - How to avoid Power Query Formula.Firewall permissions errors? - Stack Overflow
Also try the method provided by ImkeF.👍
Solved: Formula.Firewall Error in combination with PowerQu...
How to fix the Formula.Firewall error in Power Query
More details:
Behind the scenes of the Data Privacy Firewall

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors