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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
AliPoTD
Frequent Visitor

Power Query Combine files containing different Date column headers

Hello all,

 

Please can I ask for your help with an issue I am having combining files in Power Query.

 

I have several Excel files which have a number of columns with a date as the header.

Each day, another Excel file is received with the same layout except that it will have replaced a Date column with a new date column containing a different date.

 

When I try to combine them in Power Query, I edit one of the files in the folder in the "Transform Sample File", but when this is then used to merge the multiple files in the main query, I receive an error stating that it is missing a particular Date column. 

For Example:

File 1 Column Headers

SourceCustomer15/05/202416/05/2024

File 2 Column Headers

SourceCustomer16/05/202417/05/2024

 

If i use e.g File 1 as the Sample file, i then get an error stating that it can't find column "15/05/2024". This will occur with any of the files as they all differ slightly in which dates they show.

 

What I need is for the end result to be e.g.

SourceCustomer15/05/202416/05/202417/05/2024

 

I'm guessing I need to utilise a List in some way, but I'm not sure of how to do this.

Any advice greatly appreciated, many thanks!

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi,

Thanks for the solution @HotChilli  provided and i want to offer some more information for user to refer to.

hello @AliPoTD , based on your description, you can refer to the following solution.

in power query, after combing the file, click the invoke custom function step and remove the steps below it.

vxinruzhumsft_0-1716358160509.png

Then select transform file column, and select remove other columns

vxinruzhumsft_2-1716358334063.png

 

Then expand the column.

vxinruzhumsft_3-1716358363161.png

 

Output

vxinruzhumsft_4-1716358375225.png

 

 

 

Best Regards!

Yolo Zhu

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

HotChilli
Super User
Super User

It looks like it would be better to Unpivot the date columns in the sample file.  That will prevent loading errors and you can do any transforms required from a common base.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors