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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
robarivas
Post Patron
Post Patron

Why no Query Folding?

In Power BI Desktop I am connected to an IBM DB2 database for the first time and when I run a simple filter on a date column in the table I do not get any Query Folding. So the filter takes an indefinite amount of time to run, especially because the table is very large--over 800 million rows. Any ideas as to why such a simple filter would not be folded?

 

When I connect to the database I have a choice of using two different drivers: IBM or Microsoft. I can only connect with the Microsoft option.

4 REPLIES 4
Anonymous
Not applicable

@robarivas,

I make a test to filter rows from IBM DB2 database in Power BI Desktop, when I check the code in Advanced Editor, I note that query folding is taking place. Could you please check if the query folding occurs following the instructions in the blog below?

https://blog.crossjoin.co.uk/2016/07/26/value-resourceexpression-and-query-folding-in-power-bi/

Regards,
Lydia Zhang

Hello @Anonymous. I confirmed that Query Folding occurs when filtering most fields, which is good. However, it is specifically with Date and Date/Time fields that the Query Folding stops. And even with Date & Date/Time fields it will work if I choose (checkmark) particular dates. But if I filter for a range of dates (using After, Between, Before, etc.) then the Query Folding stops working.

 

Oh and by the way I (so far) have only noticed this on one of my largest tables in my database (i.e., my "sales" table). On other tables (so far) date filtering does not shut down query folding.  Very strange.

Anonymous
Not applicable

@robarivas,

I suspect the issue is caused by that there is large amount of data in your table. Could you please filter your data by writing specific statement during the connection and check if the issue persists?

1.PNG

Regards,
Lydia Zhang

Hello @Anonymous

 

Per your suggestion I generated a small subset of the data using a SQL statement but now no folding takes place at all. Please help. Our transaction table is our most important table. Not being able to query it quickly is a major issue. Thank you.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors