Bird
Raised Fist0
Power BIbi_tool~5 mins

Unpivoting columns in Power BI - Step-by-Step Guide

Choose your learning style10 modes available
Introduction
Unpivoting columns changes data from a wide format to a long format. It helps when you have many columns that represent similar data types and want to analyze them as rows instead. This makes your data easier to work with in reports and visuals.
When your sales data has months as separate columns and you want one column for month and one for sales amount.
When survey responses are in multiple columns and you want to list all answers in one column for easier analysis.
When product categories are columns but you want to compare them side by side in a chart.
When you receive data exports with repeated measures across columns and need to normalize it for filtering.
When you want to create a timeline from columns representing different dates.
Steps
Step 1: Open
- Power Query Editor
The data preview window shows your table with all columns visible
Step 2: Select
- the columns you want to unpivot
Selected columns are highlighted in the table
Step 3: Right-click
- on one of the selected column headers
A context menu appears
Step 4: Click
- Unpivot Columns in the context menu
The selected columns transform into two columns: Attribute and Value
Step 5: Rename
- the new Attribute and Value columns
Columns have meaningful names for your data context
Step 6: Click
- Close & Apply on the Home tab
The transformed data loads back into Power BI for use in reports
Before vs After
Before
Table has columns: Product, Jan, Feb, Mar with sales numbers in each month column
After
Table has columns: Product, Month, Sales with one row per product per month
Settings Reference
Unpivot Columns
📍 Right-click menu on selected columns in Power Query Editor
Transforms selected columns from wide to long format
Default: Unpivot Columns
Rename Column
📍 Double-click column header in Power Query Editor
Gives meaningful names to unpivoted columns
Default: Attribute, Value
Common Mistakes
Unpivoting all columns including the identifier columns
This causes loss of key data like product names because they get unpivoted too
Select only the columns with values to unpivot, leaving identifier columns untouched
Not renaming the Attribute and Value columns after unpivot
Generic names make reports confusing and hard to understand
Rename columns to meaningful names like Month and Sales
Summary
Unpivoting changes columns into rows to simplify data analysis.
Use it when you have repeated measures across columns that should be in one column.
Always select only the columns to unpivot and rename the new columns for clarity.

Practice

(1/5)
1. What does unpivoting columns in Power BI do?
easy
A. It merges multiple tables into one table.
B. It filters rows based on column values.
C. It creates new calculated columns based on existing data.
D. It converts multiple columns into rows to simplify analysis.

Solution

  1. Step 1: Understand the purpose of unpivoting

    Unpivoting changes the data layout by turning columns into rows, making repeated measures easier to analyze.
  2. Step 2: Compare with other operations

    Merging tables combines tables, calculated columns add new data, and filtering removes rows, which are different from unpivoting.
  3. Final Answer:

    It converts multiple columns into rows to simplify analysis. -> Option D
  4. Quick Check:

    Unpivoting = Columns to rows [OK]
Hint: Unpivoting flips columns into rows for easier data analysis [OK]
Common Mistakes:
  • Confusing unpivoting with merging tables
  • Thinking unpivoting creates new columns
  • Assuming unpivoting filters data
2. Which step correctly describes how to unpivot columns in Power Query Editor?
easy
A. Select the columns to unpivot, right-click, and choose 'Unpivot Columns'.
B. Select the columns, then click 'Merge Queries'.
C. Select the columns, then click 'Add Column' > 'Custom Column'.
D. Select the columns, then click 'Remove Columns'.

Solution

  1. Step 1: Identify the unpivot action in Power Query

    Unpivoting is done by selecting columns, right-clicking, and choosing 'Unpivot Columns'.
  2. Step 2: Differentiate from other options

    'Merge Queries' combines tables, 'Add Column' creates new columns, and 'Remove Columns' deletes columns, none unpivot data.
  3. Final Answer:

    Select the columns to unpivot, right-click, and choose 'Unpivot Columns'. -> Option A
  4. Quick Check:

    Unpivot = Right-click > Unpivot Columns [OK]
Hint: Right-click selected columns and pick 'Unpivot Columns' [OK]
Common Mistakes:
  • Choosing 'Merge Queries' instead of unpivot
  • Trying to add a custom column to unpivot
  • Removing columns instead of unpivoting
3. Given this table before unpivoting:
Product | Jan | Feb | Mar
--------|-----|-----|----
A       | 10  | 15  | 20
B       | 5   | 7   | 8

What will be the result after unpivoting the Jan, Feb, Mar columns?
medium
A.
Product | Month | Sales
--------|-------|------
Jan     | A     | 10
Feb     | A     | 15
Mar     | A     | 20
Jan     | B     | 5
Feb     | B     | 7
Mar     | B     | 8
B.
Product | Jan | Feb | Mar
--------|-----|-----|----
A       | 10  | 15  | 20
B       | 5   | 7   | 8
C.
Product | Attribute | Value
--------|-----------|------
A       | Jan       | 10
A       | Feb       | 15
A       | Mar       | 20
B       | Jan       | 5
B       | Feb       | 7
B       | Mar       | 8
D.
Product | Value
--------|------
A       | 10
A       | 15
A       | 20
B       | 5
B       | 7
B       | 8

Solution

  1. Step 1: Understand unpivot output structure

    Unpivoting converts columns Jan, Feb, Mar into rows under a new 'Attribute' column, with their values in 'Value'.
  2. Step 2: Match the correct table format

    Product | Attribute | Value
    --------|-----------|------
    A       | Jan       | 10
    A       | Feb       | 15
    A       | Mar       | 20
    B       | Jan       | 5
    B       | Feb       | 7
    B       | Mar       | 8
    shows Product repeated with each month as 'Attribute' and corresponding values, which matches unpivot output.
  3. Final Answer:

    Table with columns Product, Attribute, Value listing each month as a row. -> Option C
  4. Quick Check:

    Unpivot = Columns to Attribute-Value rows [OK]
Hint: Unpivot creates Attribute and Value columns from selected columns [OK]
Common Mistakes:
  • Thinking unpivot keeps original columns
  • Dropping the attribute column
  • Swapping row and column values incorrectly
4. You tried to unpivot columns in Power Query but the 'Unpivot Columns' option is greyed out. What is the most likely cause?
medium
A. You are in the Data view instead of Power Query Editor.
B. You have not selected any columns to unpivot.
C. Your data contains blank rows.
D. Your table has too many columns.

Solution

  1. Step 1: Check selection requirement for unpivot

    The 'Unpivot Columns' option requires at least one column selected; otherwise, it is disabled.
  2. Step 2: Eliminate other causes

    Blank rows or table size do not disable the option; being outside Power Query Editor means the option is not visible, not greyed out.
  3. Final Answer:

    No columns selected to unpivot. -> Option B
  4. Quick Check:

    Unpivot disabled if no columns selected [OK]
Hint: Always select columns before unpivoting [OK]
Common Mistakes:
  • Ignoring the need to select columns
  • Confusing Power Query Editor with Data view
  • Assuming blank rows disable unpivot
5. You have sales data with columns: Region, Product, Q1, Q2, Q3, Q4. You want to analyze quarterly sales trends by region and product. Which is the best approach?
hard
A. Unpivot the Q1, Q2, Q3, Q4 columns to create a 'Quarter' and 'Sales' column.
B. Merge the Q1 to Q4 columns into one column using concatenation.
C. Create calculated columns for each quarter's sales growth.
D. Filter the data to show only Q1 and Q2 sales.

Solution

  1. Step 1: Identify the need for unpivoting

    Quarterly sales are spread across columns Q1 to Q4; unpivoting these columns will convert them into rows with 'Quarter' and 'Sales' columns, enabling trend analysis.
  2. Step 2: Evaluate other options

    Merging columns concatenates data, which is not useful for numeric analysis; calculated columns for growth require unpivoted data first; filtering limits data and does not reshape it.
  3. Final Answer:

    Unpivot the Q1, Q2, Q3, Q4 columns to create a 'Quarter' and 'Sales' column. -> Option A
  4. Quick Check:

    Unpivot quarterly columns for trend analysis [OK]
Hint: Unpivot repeated measure columns for time series analysis [OK]
Common Mistakes:
  • Trying to merge numeric columns as text
  • Skipping unpivot before calculating growth
  • Filtering instead of reshaping data
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard