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! Learn more

Reply
Anonymous
Not applicable

Dynamic filter on YYYYMMDD in Query Editor

Hi Guys,

 

 

I need to dynamicaly filter report to keep say last 20 weeks of data from Oracle table on refresh.

(Data is snapshotted every Sunday , and is reported by Snapshot_Date_Key, Format: numeric YYYYMMDD)

We have a few large Fact tables (100 million+) and so it isn't feasbile to refresh all data every week hence only the last 20 weeks. 

(Note - we can't use incremental refresh just yet due to security concerns so need something in the meantime)

 

I have tried using a combo of Date.From(Text.From([SNAPSHOT_DATE_KEY]) and 'In the last 20 weeks' filter, which indeed works however this Date.From(Text.From) combo isn't supported in Query Folding. 

 

Can anyone think of a way of dynamic filtering on YYYYMMDD in the Query Editor?

Eg keep SNAPSHOT_DATE_KEY in the last 20 weeks from today

 

Thanks in advance!!

6 REPLIES 6
Anonymous
Not applicable

@Anonymous,


Why not directly write SQL statement during import process to limit data to last 20 weeks?

1.PNG



Regards,
Lydia

Anonymous
Not applicable

Hi thanks for the reply - but as soon as you use custom SQL, query folding becomes unavailable (which is something I mentioned I want to avoid)

Anonymous
Not applicable

@Anonymous,


When you use SQL statement to drag required data to Power BI Desktop, the performance is better than that you drag all the data to Power  BI Desktop and then filter the data in the last 20 weeks.

Regards,
Lydia

Anonymous
Not applicable

From what I understand:
Query folding already applies this filtering logic, as it passes filters to the data source (oracle database).

By putting custom SQL in at the start query folding becomes unavailable

Anonymous
Not applicable

@Anonymous,

From performance perspective, it is recommended to import required columns and rows in Power BI Desktop, then shape data and create report .

Regards,
Lydia

Anonymous
Not applicable

Hi @Anonymous just coming back to this... any ideas?

Note I can't import everything as the oracle database goes back many years and cannot bring in 100s of millions of rows - hence the filter!

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.