Relational Modeling Fundamentals: Facts vs Dimensions
Overview & Learning Objectives
Human beings love reading data in wide tables with months or years spread horizontally across columns (e.g. Jan, Feb, Mar). Databases and Power BI visual engines, however, despise wide tables—they require normalized "tall and narrow" tabular structures with a single Date column and a single Value column. "Unpivot Columns" is the single most valuable transformation tool in Power Query.
- Understand why wide spreadsheet matrices break Power BI visuals and DAX calculations.
- Execute Unpivot Columns, Unpivot Other Columns, and Unpivot Only Selected Columns.
- Handle null values and fill missing down-hierarchies cleanly.
Industry Standard
Standard: Enterprise reporting guidelines at Microsoft and Deloitte mandate that all horizontal time matrices must be unpivoted into normalized Attribute-Value pairs before entering the data model.
Real-World Example: Chai Shai Franchise Outlets
Chai Shai outlet managers submit budget projections in a wide matrix with months as column headers.
| Outlet | Q1 Budget (₹) | Q2 Budget (₹) | Q3 Budget (₹) | Q4 Budget (₹) |
|---|---|---|---|---|
| Connaught Place | 1,20,000 | 1,40,000 | 1,35,000 | 1,60,000 |
| Hauz Khas | 95,000 | 1,10,000 | 1,05,000 | 1,30,000 |
| Cyber Hub | 1,80,000 | 2,10,000 | 1,95,000 | 2,40,000 |
Syntax & Core Workflow
Select anchor columns (e.g. Outlet) -> Right-Click -> Select "Unpivot Other Columns" -> Rename "Attribute" to "Quarter" and "Value" to "Budget"
Parameters Breakdown
Unpivot Columns: Converts selected horizontal columns into vertical attribute-value row pairs.Unpivot Other Columns: Keeps anchor columns intact and unpivots all other existing and future columns dynamically.Fill Down: Replaces null values by propagating the value from the non-empty cell directly above it.Remove Empty: Filters out blank or null rows from a key identity column.
Sample Walkthrough (Q&A)
Question: Why should you always choose "Unpivot Other Columns" instead of "Unpivot Selected Columns" for monthly reports?
Formula / Action: Select the identifier column (Outlet) -> Click "Unpivot Other Columns".
Result: Dynamic resilience against new incoming month columns.
Explanation: If next month "Q5 Budget" or "May" appears in the raw file, "Unpivot Other Columns" automatically includes and unpivots it without causing your pipeline to break or drop columns.
Common Mistakes & Limitations
- Trying to write DAX measures across multiple columns (e.g. [Jan] + [Feb] + [Mar]) instead of unpivoting the months into a clean Date dimension.
- Using "Fill Down" when data is sorted incorrectly, leading to values bleeding into the wrong customer groups.
Keyboard Shortcuts
| Action | Windows | Mac |
|---|---|---|
| Unpivot Other Columns | Right-Click Anchor Header -> Click "Unpivot Other Columns" | Right-Click -> Unpivot Other Columns |
| Fill Down values | Right-Click Column -> Fill -> Down | Right-Click -> Fill -> Down |
Pro Tips & Modern Alternatives
- Always select your fixed descriptive columns (ID, Store, Category) and choose "Unpivot Other Columns" for resilient automated data pipelines.
- If you need to invert tall data back into a summary matrix for an export, use the "Pivot Column" feature with an aggregation function.