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
Karolina411
Resolver II
Resolver II

Over 45+ folder structures to pull .txt/.csv file from via Power Query

INTRO:

My mission is to pull the most recent file from various folders that are sent from the PAYOR and organize them by the most recent date per payor. Then I must pull the values for TOTALS PAID by the INSURER and form a line graph, etc.

 

Karolina411_0-1699994281851.png

 

1st I am pulling .txt files  from a Folder :

\\emirprd\edwdata\ELIGIBILITY\HAP\HFALLG

The folder structure is different in every folder  I choose:

 

 

2) I then choose the Content Column and select the columns I want from the MOST RECENT FILE

Karolina411_2-1699994281859.png

 

 

3)Then I filter and then open the columns in that file Attributes Column

 

The question is how to pull data from over 40 different folder file paths (some with many files) in an efficient way?  Has this been done before?

16 REPLIES 16
Karolina411
Resolver II
Resolver II

I am adding on a powerbi.com related issue to this problem.  When I upload it to the cloud it will not accept it.  I checked the data sources and get this : 

Karolina411_0-1702944703637.png

 

My cloud error is this: 

Karolina411_1-1702944733737.png

That being said it is tough to work out how to handle this one?  the files are being pulled form a path that can be refreshed.

Karolina411
Resolver II
Resolver II

I applied the CUSTOM Filter (update based on dates after tx date) so hopefully this will ensure it updates when new files enter the folders.

Karolina411
Resolver II
Resolver II

So even if I created a NEW date column from the list of files--just by using a FILTER it will not update my list

Karolina411_0-1701471040310.png

 

it will update every time you refresh your dataset semantic model.

Karolina411
Resolver II
Resolver II

Karolina411_0-1701197742731.png

Here is what they data looks like! Thank you!

 

Fair enough.  In that view add a filter on the Created Date.

Karolina411
Resolver II
Resolver II

@lbendlin  the import has a date column already--I just do not want to pull in this many files and those in charge of the file structure will not archive old files in a different folder. I want to pull files by > than date then also create a Dax Formula that makes the data red when the files have not pulled in by a certain date.

the import has a date column already

Which one would that be?

lbendlin
Super User
Super User

sounds like a standard process.  What have you tried and where are you stuck?

So I am getting the standard error message about 'hand authored ' queries therefore it will not upload to the cloud

Karolina411_0-1704824788352.png

 

you should use \\emirprd\edwdata as your only data source.

 

can you show some more of the Power Query script?

 

Sure--I must connect to 48 folders to pull the latest .csv file

ex:  Step 1 = add Folder

Karolina411_0-1704837506104.png

Step 2 = set up custom filter so it pulls after October (3 months prior from today)

Karolina411_1-1704837563026.png

 

- connect to the main share only, not to the subfolders

- have a list of all the subfolders

- iterate through them and fetch a list of all the files in these folders that match your criteria

- fetch the files as needed.

Thank you for your reply! The issue is how to just import .txt files > than a certain date.  The dates are found in the name itself and the column  pulled in Power Query.  How can just have a refresh on file names > than , say , November 23rd, 2023?  Thank you!

Karolina411_0-1700880539737.png

 

create a new date column from the file name, then apply your filter on that new column.

I must test that as I found if I do any filtering on the date column then when a new file enters the folders it does not update my slicer to show the latest file as it is obeying the filter placed.

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