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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
I_Like_Pi
Resolver II
Resolver II

Help please, Filtered File Folder import still evaluates contents of files filtered out

I have a folder that contains monthly files that go back years. For my purposes I only require the last 12 months.  I filter the created date. This works fine, and the resultant import is limited to that data, however when I refresh the data I can see it is loading the filtered files before filtering them out. I.e. during the load I see "x MBs of january 2005.csv"  And therefore the load takes forever!

 

Source = Folder.Files("Path")

Table.SelectRows(Source, let latest = List.Max(Source[Date created]) in each Date.IsInPreviousNDays([Date created], 730) or [Date created] = latest)

3 REPLIES 3
I_Like_Pi
Resolver II
Resolver II

That solved nothing. Using the folder import function provides a list of files with all of their file properties. This also includes the binaries themselves, and it appears PQ takes the time to load those binaries before you have had an opportunity to filter them from the list. It seems strange as you haven't yet defined how to translate the files yet (i.e. excel, csv, txt, ...). Regardless, in the end I built a Python to run in the background to copy out the current year files to a separate folder. This duplicates data, not what I wanted, but I moved on.

Power Query does NOT load the binaries until you open them on the initial load, so you can easily filter out data. It depends on where the files are being loaded from too. For example, by default, if you load files from SharePoint, it uses the SharePoint.Files() connector. But if you change it to SharePoint.Contents(), it can be much MUCH faster as it only has to load the metadata for the files in a specific folder, not the entire site.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
V-pazhen-msft
Community Support
Community Support

@I_Like_Pi 
Power BI can only load the entire data then filter them out after. This is caused by huge amount of data to be processed, how many files and rows in your folder?


Take a look at my blog, try List.MaxN function.

Dynamically Display the Most Recent N Days using P... - Microsoft Power BI Community

 


Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors