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
Anonymous
Not applicable

Combining x number of excel sheets to one Power BI Table.

Hi - basically I want to merge (I think) x number of excel sheets into one PBI table. The data example is posted below. Bascially the sheets are months, within each sheet the dates of the months are columns. There is a row per sheet for each address I am interested in. The address column with be the link between data on sheets.

 

So for one sheet I baically want to unpivot all the date columns to get it to rows which is fine.

How do I go about multiple sheets. I guess it could be from 1 to  12 or more.

 

1) Do I start with import all sheets from excel - can I tell Power Bi to do that?

2) To merge do I need to clean my sheets to get column headers so I can join the data - if so how would I do this x times - not knowing what number of sheets I may have? So for each address I would end up with all the dates from teh sheets as columns - then unpivot.

 

The alternative is to unpivot all sheets then append to one long list. Either way how would I do this dynamically not knowing how many sheets I may have?

 

Thanks in advance.

 

Supported Housing Example.PNG

4 REPLIES 4
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

I think you can add an index column for each table and then merge them by index column.

My sample:

1.png

Remove Index column , remove Top1 row and use first row as column headers.

Then unpivote the columns. Don't forget to select two columns and remove duplicate values.

Result:

2.png

 

You can download the pbix file from this link: Combining x number of excel sheets to one Power BI Table.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Anonymous
Not applicable

Thanks - so I think I am here adding columns for each table - left joining. Will I eventually run into an error on too many columns. And how would I dynamically go aboit processing x files to join. Thanks very interesting.

I blogged about it here https://exceleratorbi.com.au/combine-all-sheets-in-a-workbook-with-power-query/



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Anonymous
Not applicable

Thanks Matt very helpful, I think with your video I am well on the way to having this solved.

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.