Excel
All Top 50 Excel & Business Modeling Questions#35
Normalizing Wide Cross-Tab Reports with Power Query Unpivot
MediumEYInterview Question #35
Asked at EYA client provides an expense budget where Column A is Department, and Columns B through M contain months ('Jan', 'Feb', ..., 'Dec') with dollar amounts. You cannot build a proper Pivot Table because the months are spread across 12 separate columns. Explain how to normalize this in Power Query using Unpivot.
Input Table: WideClientBudget (A1:E3)
2 rows preview| Department (Col A) | Jan (Col B) | Feb (Col C) | Mar (Col D) |
|---|---|---|---|
| Marketing | 10000 | 12000 | 15000 |
| Engineering | 40000 | 42000 | 45000 |
Expected Output Structure6 rows
| Department | Month (Attribute) | Expense (Value) |
|---|---|---|
| Marketing | Jan | 10000 |
| Marketing | Feb | 12000 |
| Marketing | Mar | 15000 |
| Engineering | Jan | 40000 |
| Engineering | Feb | 42000 |
| Engineering | Mar | 45000 |
Interview Context
Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.
Microsoft Excel 365
E2fx
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Department (Col A) | Jan (Col B) | Feb (Col C) | Mar (Col D) | ||
| 2 | Marketing | 10000 | 12000 | 15000 | Target [Enter Formula] | |
| 3 | Engineering | 40000 | 42000 | 45000 | ||
| 4 | ||||||
| 5 | ||||||
| 6 | ||||||
| 7 |
Click on target cell E2 and enter your formula above.Shortcut: Click "Load Solution" to inspect