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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mlozano
Helper II
Helper II

Power query dynamic filter error

I am trying to create a dynamic filter with power query parameters, my data source is an Azure SQL database, the intention is to be able to filter the data by region dynamically from the report view.

I have the following code:

 

 

 

let
SelectedRegion = if Type.Is(Value.Type(RegionSelected), List.Type) then
Text.Combine({"'", Text.Combine(RegionSelected, "','"), "'"})
else
Text.Combine({"'", RegionSelected, "'"}),
selectAll = if Type.Is(Value.Type(RegionSelected), List.Type) then
List.Contains(RegionSelected, "_SelectAll_")
else
false,
query = "
SELECT * FROM abi_financial_maz_rpt.profit_loss_last_estimated_pe_rpt",
dynamicfilter = if selectAll then " "
else Text.Combine({" WHERE region_name in(", SelectedRegion, ")"}),
finalQuery = Text.Combine({query,dynamicfilter}),
Source = Sql.Database("edhazurencertdmgbqa.database.windows.net", "edhazurencertdmgbqa", [Query=finalQuery])
in
Source

 

 

 

Whenever I run my code from the power query advanced editor, my output is as follows

 

Formula.Firewall: The query 'Query 5' (step 'Source') references other queries or steps, so it cannot directly access the data source. Regenerate this data combination.*

 

*The security level is at none.

 

I also tried the following code but the error is the same

 

Sql.Database("edhazurencertdmgbqa.database.windows.net", "edhazurencertdmgbqa", [Query="SELECT * FROM abi_financial_maz_rpt.profit_loss_last_estimated_pe_rpt WHERE region_name = '"&RegionSelected&"'"])

 

The parameter is based on a list that was built with the region column:

 

mlozano_1-1654744085609.png

               mlozano_2-1654744099551.png

 

mlozano_0-1654744062642.png

 

Does anyone know how I can fix it or why it happens?

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @mlozano ,

 

This is because your Region query are sourced from other data sources or the same data source, causing the Power Query firewall error, please go to Options -> Privacy, and disable privacy.

 

vkkfmsft_1-1655090761931.png

vkkfmsft_0-1655089654369.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-kkf-msft
Community Support
Community Support

Hi @mlozano ,

 

This is because your Region query are sourced from other data sources or the same data source, causing the Power Query firewall error, please go to Options -> Privacy, and disable privacy.

 

vkkfmsft_1-1655090761931.png

vkkfmsft_0-1655089654369.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.