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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
qlegoff
Frequent Visitor

Dynamic query parameter filtering SQL database

Hi everyone,

 

I have an issue when I try to filter my SQL server statement with a query parameter generated from a dynamic list.

 

Concretely, I have a parameter which is a distinct value from a list of a Excel web file.

At the opening of the PBI template file, I can select from this list my parameter and it filters data in my report.

I would like it filters my SQL datasource too with this parameter.

 

So I try to write:

 

 

let
    Source = Sql.Database("<sql-server>", "<sql-db>", [Query="SELECT * FROM [dbo].[<my_table>] WHERE parameter = '"&parameter&"'"])
in
    Source

 

 

It works when my parameter is a simple text parameter but when I configure it to be from list request, I've got this error:

 

Formula.Firewall : Query 'Query2' (step 'Source') references other queries or steps and so may not directly access a data source. Please rebuild this data combination

I read this article : https://www.excelguru.ca/blog/2015/03/11/power-query-errors-please-rebuild-this-data-combination/ but it doesn't seem to be the same problem.

 

Thx in advance, 

 

Regards

 

2 REPLIES 2
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @qlegoff,

Based on my research, you could refert to this article to pass Parameters to SQL queries: https://www.excelguru.ca/blog/2016/04/28/pass-parameters-to-sql-queries/

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Unfortunately, it did not work with my case. Still the same problem.

For now, I just set another parameter where I copy the value from the list above and it works.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.