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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
DatataD
New Member

How to run the same query on multiple tables and append (automatically)

Hi all,

 

I've got around 200 csv files which need to be stitched together into the same data table and loaded to Power BI / Power Pivot.

 

The catch is I can't just load the whole folder in because I need to unpivot each table individually because they have dates running across the top in a row and I need them in the same column (different dates covering around three years) so I can't just filter out all the other date headers.

 

At the moment I'm faced with duplicating my query 200 times, changing the source to each individual file and then appending them.

 

Surely there is a better way?

 

Any help appreciated.

1 ACCEPTED SOLUTION
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@DatataD,


You can define data source parameter in the PBIX file. There is a similar blog for your reference, if you have any questions about the code, please let me know.

https://www.fourmoo.com/2016/11/23/power-bi-using-parameters-for-flat-file-csv-excel-sources/

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

@DatataD,


You can define data source parameter in the PBIX file. There is a similar blog for your reference, if you have any questions about the code, please let me know.

https://www.fourmoo.com/2016/11/23/power-bi-using-parameters-for-flat-file-csv-excel-sources/

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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