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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
mwvoves
Regular Visitor

Promoting headers that don't match

I've got a series of date excel files where there are a few misc rows of data at the top, then has the dates listed horizonally, one per column (see picture below). I'd like to write a query to combine and transform these files in Power BI, which are all in a shared folder, after they are unpivoted. I can go into the "Transform Sample File" and get it to work using a series of steps, but the trasnformations only work for the first file. Looking at the error on the subsequent files it appears the error comes when I promote the "Reg Hours" row below as headers the second and third files error out due to not having the same header names (because they are for 1-feb and not 1-Jan for example). Is there any way to fix this?

 

mwvoves_0-1686074222504.png

 

1 ACCEPTED SOLUTION

Hi @mwvoves 

 

I've attached a PBIX file for you.

 

Firstly, you want to Transpose the table (in the Transform tab of Power Query), then Unpivot.

 

You will have to delete your second Applied Step though, as Power BI is automatically determining your first header.

 

Let me know whether the attached is what you are after. The outputs turn out like this:

TheoC_0-1686084940004.png

 

Hope this helps!

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

4 REPLIES 4
TheoC
Super User
Super User

Hi @mwvoves 

 

Rather than promoting the Dates as "Headers,"  you should unpivot the columns so that your result is a "Dates" column and an "Amount" column.  This will then give you the basis of creating a relationship to a Date table and allow you to also undertake far better analysis comparatively.

 

Let me know if you'd like further explanation k!

 

Theo 🙂

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Here's how the table loads into power BI- are you saying I should unpivot the table as is (instead of removing the top 2 rows/promoting the first row as headers)?

 

mwvoves_0-1686082384059.png

 

Hi @mwvoves 

 

I've attached a PBIX file for you.

 

Firstly, you want to Transpose the table (in the Transform tab of Power Query), then Unpivot.

 

You will have to delete your second Applied Step though, as Power BI is automatically determining your first header.

 

Let me know whether the attached is what you are after. The outputs turn out like this:

TheoC_0-1686084940004.png

 

Hope this helps!

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Yes I was able to get it to work after using the transpose step, thank you!!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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