Bird
Raised Fist0
Power BIbi_tool~10 mins

Unpivoting columns in Power BI - Cell-by-Cell Formula Trace

Choose your learning style10 modes available
Sample Data

Sales data for products over three months (Jan, Feb, Mar). Columns B, C, D represent monthly sales.

CellValue
A1Product
B1Jan
C1Feb
D1Mar
A2Apples
B230
C240
D250
A3Bananas
B320
C325
D330
Formula Trace
Unpivot columns Jan, Feb, Mar into attribute-value pairs
Step 1: Select columns Jan, Feb, Mar to unpivot
Step 2: For each row, create new rows for each selected column with attribute and value
Step 3: Resulting table columns: Product, Attribute (Month), Value (Sales)
Cell Reference Map
    A       B       C       D  
1 Product   Jan     Feb     Mar
2 Apples    30      40      50 
3 Bananas   20      25      30 
Original table with Product names in column A and monthly sales in columns B, C, D which are unpivoted.
Result
    A       B         C  
1 Product  Month    Sales
2 Apples   Jan      30  
3 Apples   Feb      40  
4 Apples   Mar      50  
5 Bananas  Jan      20  
6 Bananas  Feb      25  
7 Bananas  Mar      30  
Unpivoted table showing each product with month and corresponding sales as separate rows.
Sheet Trace Quiz - 3 Questions
Test your understanding
What does unpivoting do to the columns Jan, Feb, and Mar?
ADeletes these columns
BDuplicates the columns
CConverts them into rows with month names and sales values
DSummarizes sales by product
Key Result
Unpivot transforms selected columns into attribute-value pairs, creating one row per original row per selected column.

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