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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

How to parameterize an odbc.query with a parameter restricted to a column from the same sql source ?

Hello,

 

I have defined a Power Query parameter called "MyParameter" whose values are restricted to a list "ListOfPossiblesValues" obtained by quering a table from a PostgreSQL database : 

 

Odbc.Query("dsn=MY-PostgreSQL-DB", "SELECT DISTINCT my_column FROM my_schema.my_table")[my_column]

 

I then want to execute a parameterize query to the same PostgreSQL data source to obtain the records that match "MyParameter" :

 

Odbc.Query("dsn=MY-PostgreSQL-DB", "SELECT * FROM my_shema.my_table WHERE my_column = '"&MyParameter&"'")

 

But whenever I try it I get the following error : "Formula.Firewall: Query "MyQuery" (step "Source") references other queries or steps and therefore cannot access a data source directly. Reconstruct this data combination."

 

I assume this is due to the fact that queries are executed in parallel so my second query can not use "MyParameter" since it is not defined when Power BI loads all the data.

 

I also tried to make a reference to "MyParameter" :

- "MyParameter" value beacome "Source"

- then I use a similar query with "Source" instead of "MyParameter" : Odbc.Query("dsn=MY-PostgreSQL-DB", "SELECT * FROM my_shema.my_table WHERE my_column = '"&Source&"'")

But I have the same error.

 

Does anyone have some insights for my use case ? 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Dynamic M query parameters feature is in preview. Please refer to offical blog for more details about Considerations and limitations.

 

  • A single parameter cannot be bound to multiple fields nor vice-versa.

  • Aggregations are not supported with the feature

  • Row-level security (RLS) is not supported with the feature

  • ...

Best Regards,
Rico Zhou

 

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
Anonymous
Not applicable

Hi @Anonymous ,

 

Dynamic M query parameters feature is in preview. Please refer to offical blog for more details about Considerations and limitations.

 

  • A single parameter cannot be bound to multiple fields nor vice-versa.

  • Aggregations are not supported with the feature

  • Row-level security (RLS) is not supported with the feature

  • ...

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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