cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
67nmark Regular Visitor
Regular Visitor

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

Accepted Solutions
67nmark Regular Visitor
Regular Visitor

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

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.

6 REPLIES 6
Seward12533 New Contributor
New Contributor

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

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 

RBlake Frequent Visitor
Frequent Visitor

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

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

Super User
Super User

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

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/

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




Super User
Super User

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

@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

 

 

67nmark Regular Visitor
Regular Visitor

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

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.

Community Support Team
Community Support Team

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

@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
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 430 members 4,459 guests
Please welcome our newest community members: