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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
Aaron301
Frequent Visitor

Query folding using a previous query to filter

 
Hello. I am working with a dataflow gen2 in Fabric and trying to filter my main query by a max date that I get from my lakehosue. When I do this the query stops folding so I had to insert a step to filter by a static number of days before it to make it manageable as a workaround.
 
Is there anyway to do this in a way that the query folds?
 
Thanks in advance!
 
Last_Activity_Date:
Aaron301_0-1692642797014.png

 

Main Query: 

Aaron301_1-1692642797014.png

 

 

2 REPLIES 2
GilbertQ
Super User
Super User

Hi @Aaron301 

 

In your dataflow gen2 you could use the table called "Last_Activity_Date" and on the table right click and select Drill Down. This will result in the table having a single value which you can then re-use.

 

Then in your Main query where you have got the filter you could use the table name as the filter.

This is what you are looking for after the drill down

GilbertQ_0-1692654088683.png

 





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

Proud to be a Super User!







Power BI Blog

Thanks for the quick reply but Last_Activity_Date is already returning a single value as a DateTime and I am already calling that in the main query as you said.

 

I know that you can't append queries without breaking folding but it seems silly that it wouldn't be able to use the value from the first query as a variable in the Where predicate so I feel like I must be doing something wrong.

 

I copied and pasted the value returned from the first query, converted it to a DateTime and replaced the call to it in the main query with it and it folds. If I use the DateTime returned from Last_Activity_Date the data returned is correct but it doesn't fold.

 

Folds:

Aaron301_0-1692670415188.png

Doesn't fold:

Aaron301_1-1692670634866.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Solution Authors