Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I'am a newbi to PBI and I have a question.
I am using PowerBI Desktop which is linked to a PostgreSQL-database. There are very large tables so I would like to limited the linked tables with DirectQuery and an SQL statement.
Get Data > PostGreSQL database > Data Connectivity Mode "DirectQuery" added the sql statement in the Advanced Options
select * from public.address
where "ID" = (select max("ID") from public.address a
group by "Enterprise_Nbr")
This doesn't work, I get the error below.
If I try another query: select * from address where Enterprise_Nbr = "x" this works.
I get that there is a problem with the subquery but how do I solve this?
Thanks
Solved! Go to Solution.
Found it 🙂
= Value.NativeQuery(PostgreSQL.Database("000.000.00.0:5432", "kbo"), "select * from address where ""ID"" in (select max(""ID"") from address group by ""Enterprise_Nbr"")", null,[EnableFolding=false] )
I figured out how to enable the query folding but the downside is that I have to convert the sql statement manually.
This one works:
= Value.NativeQuery(PostgreSQL.Database(".000.000.00.0:5432", "kbo"), "select * from address", null,[EnableFolding=false] )
But when I try the query that I need I get an error. I can't seem to find the error in the syntax.
= Value.NativeQuery(PostgreSQL.Database("000.000.00.0:5432", "kbo"), "select * from address#(lf)where ""ID"" in (select max(""ID"") from address a group by ""Enterprise_Nbr""", null,[EnableFolding=false] )
Found it 🙂
= Value.NativeQuery(PostgreSQL.Database("000.000.00.0:5432", "kbo"), "select * from address where ""ID"" in (select max(""ID"") from address group by ""Enterprise_Nbr"")", null,[EnableFolding=false] )
I think I am a little bit closer now. 👍 I get an other error message (see below). From other posts I understand that you can change the EnableFolding option in Transform Data / Source. But I can't seem to get there.
If I click "Retry" I get the same message (seems logical), if I click "Edit" than I get the startscreen from GetData where there isn't an option to enablefolding.
I am using a blank pbix-file without any links, imports.
https://learn.microsoft.com/en-us/power-query/connectors/postgresql
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 64 | |
| 31 | |
| 29 | |
| 24 |