How to Transform Wide Data into a Date and Measure Table in Power Query
Question details
The user needs to reshape a wide-format Excel dataset containing repeating date and measure columns into a normalized table with distinct Date, Measure, and Value fields.

- Product
- Excel
- Device & OS
- not provided
- Scenario
- Normalizing complex cross-tabular data with multiple header rows into a flat structure for better analysis, pivot reporting, and data modeling.
- Observed behavior
- Data is currently spread across multiple columns for varying dates and measures, requiring dynamic unpivoting and multi-row header transformations to achieve a flat format.
Ensure your source data is formatted as an Excel Table or a Named Range with some extra empty rows and columns included to accommodate future expandable data.
Use Power Query to Dynamically Unpivot and Split Columns
This method dynamically detects columns, merges multi-row headers, unpivots the data, and splits the attributes without hard-coding specific field names, ensuring flexibility when new data is added.
Since the source data contains two rows of headers (e.g., Date on the first row, Measure on the second), Power Query requires you to temporarily merge these rows before unpivoting. Once combined and unpivoted, the resulting combined attribute can be split back into distinct Date and Measure columns.
Select your data range in Excel, go to the 'Data' tab, and click 'From Table/Range' to open the Power Query Editor.
Use the Home tab options to 'Remove Blank Rows'. To remove empty columns, you can select the populated columns, right-click, and choose 'Remove Other Columns', or apply an M-code step to filter out null columns.
Since Power Query does not support multi-row headers, combine the values of the first two rows (Date and Measure) into a single row separated by a custom delimiter (like '='). Then, go to the Home tab and click 'Use First Row as Headers'.
Select your fixed identifier columns (e.g., Product Brand, Product Name, Region). Right-click the column headers and select 'Unpivot Other Columns'. This transforms all your combined date/measure columns into two new columns: 'Attribute' and 'Value'.
Select the newly created 'Attribute' column. Go to Transform > Split Column > By Delimiter. Choose the delimiter you used earlier (e.g., '=') to split it into two separate columns: 'Date' and 'Measure'.
Select the new 'Date' column, click the data type icon in the header, and change it to 'Date'. Finally, go to Home > Close & Load to output the normalized table back to Excel.

Analyze Wide Data Formats with WPS Office
While advanced Power Query scripting is a specific Microsoft Excel feature, WPS Office provides a free, highly compatible alternative for everyday data processing, pivoting, and reporting.
- 1. Open your Excel File: Launch WPS Spreadsheet and open your existing .xlsx data file.
- 2. Utilize PivotTables: Highlight your dataset, navigate to the Insert tab, and select PivotTable to easily cross-tabulate and analyze wide data.
- 3. Save and Share: Save your analytical reports in standard Excel formats to share seamlessly with colleagues.

Frequently Asked Questions
Why should I unpivot wide data in Excel?
Unpivoting wide data transforms cross-tabular layouts into a flat, tabular structure. This normalized format is essential for efficiently creating PivotTables, building charts, or feeding data into Business Intelligence (BI) tools.
How do I handle multiple header rows in Power Query?
Power Query does not natively support multi-row headers. You must merge the top rows into a single text string separated by a unique delimiter, promote that single row to headers, and then split the columns again after you perform the unpivot operation.
Will my Power Query break if new columns are added to the source data?
No, as long as you use the 'Unpivot Other Columns' command instead of selecting the specific columns to unpivot. By only fixing your identifier columns, any newly added date or measure columns will be automatically captured during the next refresh.
Why does my split Date column display an error when I change its data type?
This usually happens if the combined text format doesn't match your system's regional date settings (e.g., MM/DD/YYYY vs DD/MM/YYYY). Ensure you format the dates universally (like yyyy-MM-dd) before merging, or apply locale-specific transformations when declaring the column data type.




