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
67nmark
Helper I
Helper I

power query - combine 'from folder' and 'individual file' query

Hello,

 

I have profit and loss data stored in separate Excel files. Each file is the same in structure so I thought I'd use a 'from folder' query. The basic structure is shown below:

 

power-query.png

 

What I want to achieve is create a column for the Company Name (always in cell A2) and a column showing end of month (always in A3). Is this possibe with a folder query?

 

Thanks in advance,

Mark

 

 

1 ACCEPTED SOLUTION

Thanks very much. I ended up with VBA where I could record the query and then do everything else and the output is saved into the folder.

View solution in original post

6 REPLIES 6
Seward12533
Solution Sage
Solution Sage

Yes but it woudl help alot if the data was in the format of table with the information represented as columns in the data table  (may require it)

 

Company    Month         DATA  Item 

ACME         6/1/2018      A        1 

Thanks for the reply, I can use Power Query transforms to set up an individual file as a table and that works great. When I apply the transforms to a folder then the additional columns I have created for company name and date show the date and the company name and date for the latest file added, overwriting the entire company name column with that value.

 

I'm thinking that the from folder query option will only work with specific transforms but I'm trying to confirm this.

 

Cheers,

Mark

To make this work for multiple files from a folder, you have to transform your query into a function and apply that to all rows of the from-folder-table:

 

video: https://www.youtube.com/watch?v=Ar_fV_oXSNs

blogs: https://blogs.msdn.microsoft.com/mvpawardprogram/2013/08/19/creating-power-query-functions/

https://www.mattmasson.com/2014/11/converting-a-query-to-a-function-in-power-query/

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

@67nmark

 

Sometime back, I created few Custom Functions in Excel that could pull cell values from Multiple Closed Workbooks

http://www.excelnaccess.com/connect-multiple-workbooks/

 

But I prefer to use Power Query as well

 

Getfiles

 

 


Regards
Zubair

Please try my custom visuals

Thanks very much. I ended up with VBA where I could record the query and then do everything else and the output is saved into the folder.

@67nmark,

 

Glad to hear that. You may help accept the solution above. Your contribution is highly appreciated.

Community Support Team _ Sam Zha
If this post helps, then please consider 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.