Fatskills
Practice. Master. Repeat.
Study Guide: TECH **Power BI: Unpivot, Pivot, Transpose, and Fill Down/Up – Zero-Fluff Study Guide**
Source: https://www.fatskills.com/data-science/chapter/tech-power-bi-unpivot-pivot-transpose-and-fill-downup-zero-fluff-study-guide

TECH **Power BI: Unpivot, Pivot, Transpose, and Fill Down/Up – Zero-Fluff Study Guide**

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~7 min read

Power BI: Unpivot, Pivot, Transpose, and Fill Down/Up – Zero-Fluff Study Guide

For engineers who need to reshape data fast—without guesswork.


1. What This Is & Why It Matters

You’ve inherited a Power BI report where sales data is stored in a wide format (columns for each month: Jan, Feb, Mar, …). Your boss asks for a trend analysis by product, but the current table structure makes this impossible—you can’t filter, group, or visualize trends without reshaping the data first.

This is where Unpivot, Pivot, Transpose, and Fill Down/Up come in.
- Unpivot turns columns into rows (e.g., Jan: 100, Feb: 200Month: Jan, Value: 100).
- Pivot turns rows into columns (the reverse of unpivot).
- Transpose flips rows ↔ columns (like Excel’s TRANSPOSE).
- Fill Down/Up propagates values into blank cells (e.g., filling missing dates in a time series).

Why this matters in production:
- Broken visuals: Power BI can’t aggregate or filter data in a wide format. Unpivoting is required for time-series charts, matrices, or drill-downs.
- ETL nightmares: If you don’t reshape data early, you’ll waste hours writing DAX measures to work around bad structure.
- Performance: Wide tables bloat memory. Unpivoted data is leaner and faster to process.
- Automation: These transformations let you clean messy Excel exports or API responses before they hit your model.

Real-world scenario:
You’re handed a CSV where each row is a product, and columns are months (Product | Jan | Feb | Mar). To build a line chart of sales over time, you must unpivot the months into a Date column. If you don’t, your chart will show products on the X-axis instead of time—useless for trend analysis.


2. Core Concepts & Components


? Unpivot

  • Definition: Converts selected columns into rows, creating an Attribute (column name) and Value (cell value) pair.
  • Production insight: Always unpivot time-series data. If you see columns like 2023-01, 2023-02, etc., unpivot them into a Date column. This enables time intelligence (e.g., SAMEPERIODLASTYEAR in DAX).

? Pivot

  • Definition: Converts unique values from a column into new columns (the reverse of unpivot).
  • Production insight: Use sparingly—pivoting can explode your column count. Only pivot when you need a matrix-style layout (e.g., Product | Q1 | Q2 | Q3).

? Transpose

  • Definition: Swaps rows and columns (e.g., a table with 5 rows and 10 columns becomes 10 rows and 5 columns).
  • Production insight: Rarely useful in Power BI. Transpose is a last resort—it breaks data relationships and makes filtering harder. Prefer Unpivot or Pivot instead.

? Fill Down/Up

  • Definition: Propagates the last non-blank value into blank cells below (Fill Down) or above (Fill Up).
  • Production insight: Critical for hierarchical data (e.g., Region | Subregion | Sales). If Subregion is blank for some rows, Fill Down ensures every row has a value.

? "Wide" vs. "Tall" Data

  • Wide data: Columns represent variables (e.g., Jan, Feb, Mar). Hard to analyze in Power BI.
  • Tall data: Rows represent observations (e.g., Date | Value). Required for most visuals and DAX.
  • Production insight: Power BI loves tall data. Always aim for this structure.

? Power Query vs. DAX

  • Power Query: Use for reshaping before data loads into the model (e.g., unpivot, fill down).
  • DAX: Use for calculations after data is loaded (e.g., SUM, CALCULATE).
  • Production insight: Reshape in Power Query—it’s faster and reduces model size.


3. Step-by-Step Hands-On


Task: Unpivot Monthly Sales Data

Prerequisites:
- Power BI Desktop installed.
- A table like this (copy into Excel or Power BI):


Product Jan Feb Mar
Laptop 100 150 200
Mouse 50 60 70

Goal: Unpivot the months into a Date column for a line chart.


Steps:

  1. Load the data:
  2. In Power BI, click Home > Get Data > Excel (or Enter Data if using the table above).
  3. Load the table (name it Sales).

  4. Open Power Query Editor:

  5. Click Transform Data to open Power Query.

  6. Unpivot the months:

  7. Select the Product column (hold Ctrl to multi-select).
  8. Right-click > Unpivot Other Columns.
  9. Rename the new columns:
    • AttributeMonth
    • ValueSales

Result:


Product Month Sales
Laptop Jan 100
Laptop Feb 150
... ... ...
  1. Convert Month to a date:
  2. Select the Month column.
  3. Click Add Column > Custom Column.
  4. Enter this formula:
    powerquery
    Date.FromText("2023-" & [Month] & "-01")
  5. Rename the column to Date.
  6. Remove the Month column.

  7. Close & Apply:

  8. Click Close & Apply to load the data into Power BI.

  9. Build the line chart:

  10. Add a Line Chart visual.
  11. Drag Date to the X-axis, Sales to the Y-axis, and Product to the Legend.
  12. Boom—you now have a trend analysis by product.

Task: Fill Down Missing Subregions

Prerequisites:
- A table with missing values:


Region Subregion Sales
North East 100
North 200
South West 150
South 50

Goal: Fill down the Subregion column so every row has a value.


Steps:

  1. Load the data into Power Query.
  2. Select the Subregion column.
  3. Click Transform > Fill > Down.
  4. Result:
Region Subregion Sales
North East 100
North East 200
South West 150
South West 50
  1. Close & Apply.

4. ? Production-Ready Best Practices


? Security

  • Hide sensitive columns: After unpivoting, remove or mask columns with PII (e.g., CustomerID).
  • Row-level security (RLS): If unpivoting creates a User column, use RLS to restrict data access.

⚡ Performance

  • Filter early: Unpivot only the columns you need. Extra columns slow down queries.
  • Disable "Enable load" for staging tables: If you create intermediate tables (e.g., Sales_Unpivoted), disable their load to the model to save memory.

? Reliability & Maintainability

  • Name steps descriptively: In Power Query, rename steps like Unpivoted_Months instead of Step 3.
  • Document assumptions: Add a comment in Power Query (right-click step > Properties) explaining why you unpivoted or filled down.
  • Use parameters: For dynamic unpivoting (e.g., unpivot columns matching a pattern), use Power Query parameters.

? Observability

  • Check row counts: After unpivoting, verify the row count makes sense (e.g., Original rows * unpivoted columns).
  • Profile data: Use View > Column Profile to spot anomalies (e.g., blank values after Fill Down).


5. ⚠️ Common Mistakes & Traps

Mistake Symptom Fix/Prevention
Unpivoting the wrong columns Missing data in visuals Select only the columns to unpivot (e.g., months), not keys like ProductID.
Not converting dates Line chart shows text instead of dates After unpivoting, convert Month to a date (e.g., Date.FromText).
Fill Down on non-hierarchical data Incorrect values propagated Only use Fill Down for hierarchical data (e.g., Region > Subregion).
Pivoting too early Exploding column count Pivot only for matrix visuals; prefer unpivoting for analysis.
Ignoring blank values Gaps in time-series charts Use Replace Values or Fill Down to handle blanks before unpivoting.


6. ? Exam/Certification Focus (PL-300)


Typical Question Patterns

  1. Unpivot scenario:
  2. "You have a table with columns Product | Jan | Feb | Mar. How do you create a line chart of sales over time?"
  3. Answer: Unpivot the months into a Date column.

  4. Fill Down scenario:

  5. "A table has missing Subregion values. How do you ensure every row has a Subregion?"
  6. Answer: Use Fill Down on the Subregion column.

  7. Pivot vs. Unpivot trap:

  8. "When should you use Pivot instead of Unpivot?"
  9. Answer: Only for matrix-style layouts (e.g., Product | Q1 | Q2). For analysis, always unpivot.

  10. Transpose warning:

  11. "What’s the risk of using Transpose in Power BI?"
  12. Answer: It breaks relationships and makes filtering harder. Avoid it.

Key ⚠️ Trap Distinctions

  • Unpivot vs. Pivot:
  • Unpivot = columns → rows (for analysis).
  • Pivot = rows → columns (for matrices).
  • Fill Down vs. Fill Up:
  • Fill Down: Propagate values downward (e.g., RegionSubregion).
  • Fill Up: Propagate values upward (rare; use only for specific hierarchies).


7. ? Hands-On Challenge

Challenge:
You have this table in Power BI:


Employee Manager 2023-01 2023-02 2023-03
Alice Bob 500 600 700
Charlie Bob 300 400

Task:
1. Unpivot the months into a Date column.
2. Fill down the Manager column (Charlie’s manager is missing).
3. Convert the Date column to a proper date format.

Solution:
1. Select Employee and Manager columns > Unpivot Other Columns.
2. Rename Attribute to Month, Value to Sales.
3. Add a custom column: Date.FromText([Month] & "-01").
4. Select Manager column > Fill Down.
5. Remove the Month column.

Why it works:
- Unpivoting creates a tall table for analysis.
- Fill Down ensures Charlie’s manager is Bob.
- Converting to a date enables time intelligence.


8. ? Rapid-Reference Crib Sheet

Action Power Query Steps Shortcut
Unpivot columns Select columns > Right-click > Unpivot Other Columns Alt + P, U, O
Pivot column Select column > Transform > Pivot Column > Choose value column Alt + T, P
Transpose Transform > Transpose Alt + T, T
Fill Down Select column > Transform > Fill > Down Alt + T, F, D
Fill Up Select column > Transform > Fill > Up Alt + T, F, U
Convert to date Select column > Add Column > Custom Column > Date.FromText([Column])
Remove blanks Select column > Home > Remove Rows > Remove Blank Rows Alt + H, R, B
Replace values Select column > Home > Replace Values Ctrl + H

⚠️ Exam Traps:
- Default date format: Power BI may not recognize Jan as a date—always convert to YYYY-MM-DD.
- Unpivoting keys: Never unpivot primary keys (e.g., ProductID). Only unpivot measures (e.g., Sales).
- Fill Down order: Ensure data is sorted correctly before filling (e.g., Region before Subregion).


9. ? Where to Go Next

  1. Microsoft Docs: Unpivot columns
  2. Power BI Guided Learning: Transform Data
  3. SQLBI: Data Modeling for Power BI (for advanced reshaping strategies)
  4. Guy in a Cube: Power Query Tips (video tutorials)


ADVERTISEMENT