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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors