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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ACVMontreal
Frequent Visitor

Demote headers before expanding

Hi, I have a problem with my data. I am reading multiple files in a sharepoint folder. Initially I had csv files, I had some trouble since the name of the files were differents I opted to change for an excel format where my sheets are all named the same.

 

Now I have a different problem I didn't have with csv. I have to transform the data before using it,  it's not a perfect table, all the files have a title (where the date is included) . The thing is, when I expand, powerquery names the first column as the title, which contains a date, so the title of every file is never the same. 

 

The problem is that since it gives that name to the column, it cannot find the same column in my other files. As a result I only get the complete first column of the first file, the column is then "null" for all the other files. 

 

Is there a way to demote the name it gives to the column before expanding? Since afterwards it's too late, because the data is already missing. 

1 ACCEPTED SOLUTION
edhans
Super User
Super User

If you go into the "Sample Query" that Power Query generates, you can do the Demote Headers step there, or simply remove the "Promote first row to header" step it probably auto-generated.

 

If you need more help, can you give some screen shots to more clearly explain the issue?



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

5 REPLIES 5
ACVMontreal
Frequent Visitor

Thank you all! I didn't know you could actually have previous steps in the sample query that affected the data. So simple... Yet you have to know it's there.

Yes. Everything you do in the Sample Query will affect every file before they actually get combined. Can be handy sometimes. Glad to help @Jimmy801 



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Jimmy801
Community Champion
Community Champion

Hello @ACVMontreal 

 

but why should power query include the name of the file in your column names? So probably you said to do so.

What you can do is to first read from the folder, read from your files at that level, in order that you get one table of every file (the columns should be alligned now, as no date is read to your column names), expand that table. So now you have your tables combined, and the name (which contains the date) of the file you can find on every row. Is this what you are looking at?

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

edhans
Super User
Super User

If you go into the "Sample Query" that Power Query generates, you can do the Demote Headers step there, or simply remove the "Promote first row to header" step it probably auto-generated.

 

If you need more help, can you give some screen shots to more clearly explain the issue?



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
mahoneypat
Microsoft Employee
Microsoft Employee

This sounds like you could use relative references vs. absolute ones.  When you have a step that specifically calls your first column by name, you get errors with the other files.  You can reference the first column for example instead of it by name.  Please see if this video helps.

https://www.youtube.com/watch?v=nscUeOL5m90

 

Regards,

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors