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
kamilos01
New Member

Query Folding dissable after using filter - ODBC - Postgresql Unicode

Hi,
I have a problem with keeping query folding in my query when merging three datasets into one. I'm using Odbc.DataSource, and everything works fine until the filtering part, where I want to use RangeStart and RangeEnd parameters to enable incremental refresh. For the column and parameters, I'm using the DateTime type in Power Query and timestamp in PostgreSQL.
I noticed that after applying any filter in Power Query, the "View Native Query" option becomes greyed out. This makes me think it could be related to the way I'm retrieving data.

kamilos01_0-1738316808955.png

kamilos01_1-1738316851076.png

 

 

2 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @kamilos01  -Yes, the issue you're facing is most likely due to query folding breaking when you apply a filter using RangeStart and RangeEnd in Power Query.

 as checked the steps, bfore merging, apply the date filter as early as possible.This ensures filtering happens before merging.If the View Native Query option remains greyed out, then filtering is happening locally. in someways, Instead of merging in Power Query, try joining tables in PostgreSQL first and then importing the result.

 

Hope the above information helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

Hi @rajendraongole1
Thanks for your suggestions. Yes, I was trying to filter out as early as possible (including other columns), but always "View native query" was greyed out.
Initially I wanted to use join in my postgresql DB earlier, but simple table was too big to get it and I always got an error.

View solution in original post

7 REPLIES 7
v-csrikanth
Community Support
Community Support

Hi @kamilos01 

I wanted to follow up since I haven't heard from you in a while. Have you had a chance to try the suggested solutions. If the issue has been resolved, we kindly request you to share the resolution or key insights here to help others in the community. If we don’t hear back, we’ll go ahead and close this thread.

Should you need further assistance in the future, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.

 

Thank you for your understanding and participation.

Best Regards,
Cheri Srikanth

v-csrikanth
Community Support
Community Support

Hi @kamilos01 
We haven't heard from you since last response and just wanted to check whether the solution provided has worked for you. If yes, please accept as solution to help others benefit.
Thank you.

v-csrikanth
Community Support
Community Support

Hi @kamilos01 

As highlighted by @rohit1991 and @rajendraongole1 , the proposed approach appears to effectively address your requirements. Could you please confirm if your issue has been resolved?

If you are still facing any challenges, kindly provide further details, and we will be happy to assist you.


If the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.

Thanks,
Cheri Srikanth.

rohit1991
Super User
Super User

hi @kamilos01 ,

 

This is a classic issue with Power BI and ODBC sources like PostgreSQL query folding breaks when Power Query can’t push your filter step down to the database, so it processes everything locally (which is way slower).

 

Here’s what you can do:

 

  1. Filter as early as possible: Always place your RangeStart/RangeEnd (or any filter) as the first steps in your query before merges or transformations. This gives Power Query the best shot at folding.

  2. Check your data types: Make sure both your parameter and the column in PostgreSQL are the same data type (ideally timestamp). Even a small mismatch will break folding.

  3. Avoid anything that blocks folding: Steps like Table.Buffer or complex calculated columns can stop folding dead in its tracks. Keep things simple up to your filter step.

  4. Try a native SQL query: If folding just won’t work, use a native SQL query inside Power Query (Home > Advanced Editor).

  5. Update your ODBC driver: Sometimes just using the latest PostgreSQL ODBC driver (or even switching to Npgsql in DirectQuery mode) improves folding support.

  6. For merges/joins: If possible, do your joins in the database first (using a view or SQL), then pull the result into Power BI, instead of merging in Power Query.

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Hi @rohit1991,
Thanks for your suggestions. Unfortunately the last one is the right one.
Just after uploading the table, I tried to filter any column (text, numeric, date) but always the "View native query" field got greyed out 😞 Also using select doesn't work.
I'm not using the Table.Buffer function.

 

Maybe using native postgresql is an option.

rajendraongole1
Super User
Super User

Hi @kamilos01  -Yes, the issue you're facing is most likely due to query folding breaking when you apply a filter using RangeStart and RangeEnd in Power Query.

 as checked the steps, bfore merging, apply the date filter as early as possible.This ensures filtering happens before merging.If the View Native Query option remains greyed out, then filtering is happening locally. in someways, Instead of merging in Power Query, try joining tables in PostgreSQL first and then importing the result.

 

Hope the above information helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1
Thanks for your suggestions. Yes, I was trying to filter out as early as possible (including other columns), but always "View native query" was greyed out.
Initially I wanted to use join in my postgresql DB earlier, but simple table was too big to get it and I always got an error.

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 Kudoed Authors