Forum Discussion
Anonymous
2 years agoNot applicable
DirectQuery error when loading visualization from PostgreSQL table using Dynamic M query parameter
I'm trying to create a line graph in Power BI desktop from an on-premises PostgreSQL database table via DirectQuery while using a Dynamic M query parameter, and the visualization fails to load. I get...
- 2 years ago
Instead of using the Query option directly I recommend you try the Value.NativeQuery variation. That may make it easier to consume the parameter.
Anonymous
2 years agoNot applicable
I'm happy to report that using Value.NativeQuery with the [EnableFolding = true] option enabled resulted in the visualization loading successfully:
let
Source = PostgreSQL.Database("Insert IP address here", "Insert database name here"),
Query = Value.NativeQuery(
Source,
"SELECT * FROM foo1.test WHERE proj = " & Text.From(ProjID_Parameters) & "",
null,
[EnableFolding = true])
in
Query
Before including the EnableFolding option, the table would load fine in Power Query Editor but the same visualization error occurred. I stumbled upon a blog post that discussed passing parameters via query folding, along with why EnableFolding needed to be included.
Thanks for the assistance!