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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Ffitzpatrick47
Helper II
Helper II

parameterized queries, query folding and postgre

I have a postgre database (which is cheaper than mssql server) and want to make a parameterized query.  Here's my code:

let
parameters = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
pr = Table.TransformColumnTypes(parameters,{{"key", type text}, {"value", type datetime}}),
prs = Table.SelectRows(pr, each ([key] = "Begin date")),
end_date = prs{0}[value],
string = "select * from h_ar_stage gangster = '"& Text.From(end_date) &"'",
Source = PostgreSQL.Database("localhost", "kobe_bryant", [Query="select * from h_ar_stage"])
in
Source

 

I have to munge around with the date format for the code to actually work, but before I do that, does anyone know the story behind this?

http://community.powerbi.com/t5/Issues/Bug-Query-folding-not-working-with-non-SQL-datasource/idi-p/2...

 

When they say non sql, does that mean non sql server, or non ansi sql based queries.  Knowing msft, I think its likely they weren't smart enough to implement their folding code off of odbc logic and are forming the sql code natively.

 

Also, this is so epically kludgey, is there a more official way to handle parameters in power query?  In the normal data tab, they have msft query, which could be nice, and there are posts from just a couple of years ago where using ?'s work if its in the predicate, though in ssdt, I think the ?'s work everywhere.  Hard to say what' the current best practice.  It changes every year, presumable to keep people in employment.

1 ACCEPTED SOLUTION

@Ffitzpatrick47,

 

I didn't see any other way. You may create a support ticket.

Community Support Team _ Sam Zha
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

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@Ffitzpatrick47,

 

You could also take a look at Text.Format function.

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

Yes, I'm sure I can format the date to a postgre date string. My real question was on query folding and a more official parameter push down method. Do you know?

@Ffitzpatrick47,

 

I didn't see any other way. You may create a support ticket.

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors