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
amirghaderi
Helper IV
Helper IV

Multiple Excel data source by date in one file

Hi,

I save a file every week in a folder. So the folder has files saved by week in that folder. I want Power Bi to read all files in the folder and combine them as one table and add a column which shows the data is from which file (week).

Example files in the folder:

File 1 07-Feb-2020    It has Column A/Column B/Column C

File 2 14-Feb-2020    It has Column A/Column B/Column C

File 3 21-Feb-2020    It has Column A/Column B/Column C

 

Table in Power Bi to be as below:

Column A/Column B/Column C/New column (Date of file):

Column A/Column B/Column C/07-Feb-2020

Column A/Column B/Column C/14-Feb-2020

Column A/Column B/Column C/21-Feb-2020

 

Thanks,

 

Amir

 

 

 

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

You want to do a File Combine operation, but then you'll need to edit the sample transformation query. In Power Query:

  1. Get Data From Folder
  2. Select Transform Data
  3. Filter it so it only shows the files you want (assuming it has other things in it. May be able to skip this step if this folder never has other stuff in it.)
  4. In the Content column, select the double-down arrow and combine, then select the data in the first file want (Table, sheet, whatever)
  5. You should now have all of your data, except the column you want with the file name.
  6. Your query pane will look something like this:
    1. 2020-02-23 05_46_45-OneDrive - eHansalytics - Power Query Editor.png
  7. Here is where it gets tricky, as both Excel and Power BI have changed. You need to find the Removed Other Columns step either in the main query (my [OneDrive - eHansaltyics] query) or in the [Transform Sample File] query and make sure the "Source.Name" Column is checked. Newer versions of Power BI and Excel Power Query do this, but as recently as last month, they hid it.

2020-02-23 05_57_59-OneDrive - eHansalytics - Power Query Editor.png



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

View solution in original post

3 REPLIES 3
edhans
Super User
Super User

You want to do a File Combine operation, but then you'll need to edit the sample transformation query. In Power Query:

  1. Get Data From Folder
  2. Select Transform Data
  3. Filter it so it only shows the files you want (assuming it has other things in it. May be able to skip this step if this folder never has other stuff in it.)
  4. In the Content column, select the double-down arrow and combine, then select the data in the first file want (Table, sheet, whatever)
  5. You should now have all of your data, except the column you want with the file name.
  6. Your query pane will look something like this:
    1. 2020-02-23 05_46_45-OneDrive - eHansalytics - Power Query Editor.png
  7. Here is where it gets tricky, as both Excel and Power BI have changed. You need to find the Removed Other Columns step either in the main query (my [OneDrive - eHansaltyics] query) or in the [Transform Sample File] query and make sure the "Source.Name" Column is checked. Newer versions of Power BI and Excel Power Query do this, but as recently as last month, they hid it.

2020-02-23 05_57_59-OneDrive - eHansalytics - Power Query Editor.png



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

Thanks for the responses. They worked for me

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.