How to Unpivot Data with Multiple Column Headers in Power Query

TLDRLearn how to unpivot data with multiple column headers in Power Query. This tutorial provides step-by-step instructions on transforming complex data layouts into a tabular dataset using Power Query.

Key insights

💡Identify anchor columns and fill any gaps in those columns.

🔑Merge anchor columns into a single column before transposing the dataset.

🔄Transpose the dataset to separate scenarios and dates into their own columns.

📊Unpivot the dataset to transform the column headers into attribute values.

⚙️Adjust the data types and remove any null cells to clean up the final report.

Q&A

What are anchor columns?

Anchor columns are the columns in the dataset that you want to keep as is, without unpivoting or transposing. In this tutorial, the anchor columns are customer names and article descriptions.

How do I fill gaps in anchor columns?

To fill gaps in anchor columns, select the column and use the "Fill Down" option in Power Query. This will populate empty cells with the values from the cells above them.

Why do I need to merge anchor columns before transposing?

Merging anchor columns into a single column allows for easier transposition of the dataset. It helps in separating scenarios and dates into their own columns, making it easier to unpivot the data.

How do I unpivot the dataset?

To unpivot the dataset, select the anchor columns, right-click, and choose the "Unpivot Other Columns" option in Power Query. This will transform the column headers into attribute values.

How do I clean up the final report?

To clean up the final report, update the data types of the columns, remove any null cells, and adjust the layout as needed. You can also apply additional formatting to make the report visually appealing.

Timestamped Summary

00:00The video introduces the problem of transposing and unpivoting data with multiple column headers.

03:31The presenter demonstrates how to create a table in Excel without using merge cells to maintain the original report layout.

07:59The process of identifying anchor columns and filling gaps in the data is explained.

11:59The presenter guides viewers through the steps of merging anchor columns, transposing the dataset, and applying the unpivot feature in Power Query.

12:50Tips for working with larger datasets and handling null cells are provided.