Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
I have a working excel sheet which has columns with project IDs, names, and other info and then values like plan, forecast, actuals etc. The problem is there are 2 row headers for these values. One is the period (months) and the other is scenarios like plan, actuals, forecast and few more. How can I bring it to PBI without makes changes in the excel sheet because thats a working file and data keeps being updated. Example of the excel sheet layout below:
Project ID | Project name | Project manager | Start date | End Date | AOP | AOP | Forecast | Forecast |
Jan | Feb.. till Dec | Jan | Feb.. till Dec | |||||
xxx | ttt | eee | sfsf | sfsf | xxx | xxx | xxx | xxx |
xxx | ttt | ee | sfsf | sfs | xxx | xx | xxx | xxx |
xxx | tt | ee | sf | sfsf | xxx | xxx | xxx | xxxx |
Solved! Go to Solution.
Follow these steps in the Power Query Editor (click Transform data on the Power BI Desktop ribbon).
1. Connect to Your Excel File
Start by connecting to your Excel workbook. When the Navigator window appears, select your sheet and click Transform Data.
2. Stop Automatic Header Promotion
Power Query will likely try to use the first row as headers. We need to stop this.
In the Applied Steps pane on the right, find the step named Promoted Headers and click the "X" to delete it.
Find the step below it named Changed Type and delete that as well.
Your table should now just have generic Column1, Column2, etc., as headers, with your data starting from the first row.
3. Transpose the Data
To easily work with the two header rows, we'll temporarily flip the entire table.
Go to the Transform tab and click Transpose. Your columns are now rows, and your rows are now columns.
4. Fill and Merge the Header Columns
Now your two header rows have become the first two columns.
Fill Down: Select the first column (which contains AOP, null, Forecast, null). On the Transform tab, click Fill > Down. This will fill the null values with the correct scenario name.
Merge Columns: Select the first column, then hold Ctrl and select the second column. Right-click one of the selected column headers and choose Merge Columns. You can use a separator like a pipe (|) or a colon (:). Click OK. You now have a single, clean header column (e.g., AOP|Jan, Forecast|Feb).
5. Transpose Back and Promote Headers
Now we flip the table back to its original orientation.
Go to the Transform tab and click Transpose again.
Now that your first row contains the correct, combined headers, go to the Home tab and click Use First Row as Headers.
6. Unpivot Your Data
This is the key step to transform your data into a proper format.
Select all of your initial project information columns (Project ID, Project name, etc.).
Right-click on any of the selected column headers.
Choose Unpivot Other Columns.
This will transform all your scenario/date columns into just two new columns: Attribute (containing your merged headers like AOP|Jan) and Value.
7. Split and Rename Columns
Finally, let's clean up the new columns.
Select the Attribute column.
On the Home tab, click Split Column > By Delimiter.
Choose the separator you used in Step 4 (e.g., the pipe |). Click OK.
Rename the newly created columns to Scenario and Month. Also, rename the Value column if needed. Check that your data types are correct (e.g., numbers, text, dates).
If this explanation and solution resolve your issue, please like and accept the solution.
Hi @jacobHW ,
BI doesn’t handle two header rows automatically. Luckily, you can sort this out in Power Query without changing your working Excel file at all. Here’s how I usually handle it:
Load your Excel sheet in Power BI and hit “Transform Data.”
Remove Power Query’s auto-promoted headers. In the Applied Steps pane, delete “Promoted Headers” and “Changed Type” so your first two rows become data, not headers.
Transpose the table (Transform > Transpose). This flips the table so you can easily combine the two header rows.
Fill down the first column, then merge the first two columns. Select the first column, go to Transform > Fill > Down. Select the first and second columns, right-click > Merge Columns. Use something like a pipe | as a separator. Now you have one row of “combined” headers (e.g., Forecast|Jan, AOP|Feb).
Transpose again, then promote the first row to headers.
Unpivot the data. Select your identifying columns (like Project ID, Project Name). Right-click any of the scenario columns and choose “Unpivot Other Columns." Now all your scenario values are in two columns: one for the attribute (e.g., Forecast|Jan), one for the value.
No need to change the Excel sheet itself, this method will keep working even if new months/scenarios are added.
Follow these steps in the Power Query Editor (click Transform data on the Power BI Desktop ribbon).
1. Connect to Your Excel File
Start by connecting to your Excel workbook. When the Navigator window appears, select your sheet and click Transform Data.
2. Stop Automatic Header Promotion
Power Query will likely try to use the first row as headers. We need to stop this.
In the Applied Steps pane on the right, find the step named Promoted Headers and click the "X" to delete it.
Find the step below it named Changed Type and delete that as well.
Your table should now just have generic Column1, Column2, etc., as headers, with your data starting from the first row.
3. Transpose the Data
To easily work with the two header rows, we'll temporarily flip the entire table.
Go to the Transform tab and click Transpose. Your columns are now rows, and your rows are now columns.
4. Fill and Merge the Header Columns
Now your two header rows have become the first two columns.
Fill Down: Select the first column (which contains AOP, null, Forecast, null). On the Transform tab, click Fill > Down. This will fill the null values with the correct scenario name.
Merge Columns: Select the first column, then hold Ctrl and select the second column. Right-click one of the selected column headers and choose Merge Columns. You can use a separator like a pipe (|) or a colon (:). Click OK. You now have a single, clean header column (e.g., AOP|Jan, Forecast|Feb).
5. Transpose Back and Promote Headers
Now we flip the table back to its original orientation.
Go to the Transform tab and click Transpose again.
Now that your first row contains the correct, combined headers, go to the Home tab and click Use First Row as Headers.
6. Unpivot Your Data
This is the key step to transform your data into a proper format.
Select all of your initial project information columns (Project ID, Project name, etc.).
Right-click on any of the selected column headers.
Choose Unpivot Other Columns.
This will transform all your scenario/date columns into just two new columns: Attribute (containing your merged headers like AOP|Jan) and Value.
7. Split and Rename Columns
Finally, let's clean up the new columns.
Select the Attribute column.
On the Home tab, click Split Column > By Delimiter.
Choose the separator you used in Step 4 (e.g., the pipe |). Click OK.
Rename the newly created columns to Scenario and Month. Also, rename the Value column if needed. Check that your data types are correct (e.g., numbers, text, dates).
If this explanation and solution resolve your issue, please like and accept the solution.
Thanks. looks like it works. So the working sheet can still be worked on and PBI will be updated based on the steps in Transform data ?