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
LUNM
Frequent Visitor

Getting only the files from the last x years

Hello,

 

I have a folder with a bunch of flat files that were extracted every month for the past ten years, so 120 files. However, I want to be able to get only the files from the past five years. The date is in all the filenames. This is what I did :

#"Custom Column added" = Table.AddColumn(Source, "Custom", each Number.FromText(Text.Range([Name],0,4))),
#"Custom Column added1" = Table.AddColumn(#"Custom Column added", "Custom.1", each if [Custom] >= List.Max(#"Custom Column added"[Custom])-4 then 1 else 0),
#"Filtered Rows" = Table.SelectRows(#"Custom Column added1", each ([Personnalisé.1] = 1)),

 

However, the files are all loaded everytime I duplicate the table which takes an enormous amount of time. Is there a better option that optimizes performance?

 

Thanks in advance,

ETA: Here's a sample of the data in Power Query

ContentNameExtensionDate accessedDate modifiedDate createdAttributesFolder PathCustomCustom.1
Binary2020-11-30 TX_[...].xlsx.xlsx2022-05-30 11:13:232022-05-30 11:13:232022-05-30 11:13:24RecordC:\[...]20201
Binary2015-11-30 TX_[...].xlsx.xlsx2020-05-30 11:13:232020-05-30 11:13:232020-05-30 11:13:23RecordC:\[...]20150

LUNM

 

0 REPLIES 0

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.