Bird
Raised Fist0
Power BIbi_tool~20 mins

Unpivoting columns in Power BI - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Unpivoting Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ dax_lod_result
intermediate
2:00remaining
DAX to Unpivot Sales Data by Region

You have a table SalesData with columns: Product, North, South, East, West. Each region column contains sales numbers.

Which DAX expression correctly unpivots the regional sales into two columns: Region and Sales?

AUNPIVOT(SalesData, SalesData[North], SalesData[South], SalesData[East], SalesData[West])
BUNION(SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "North", "Sales", SalesData[North]), SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "South", "Sales", SalesData[South]), SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "East", "Sales", SalesData[East]), SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "West", "Sales", SalesData[West]))
CSELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", {"North", "South", "East", "West"}, "Sales", {SalesData[North], SalesData[South], SalesData[East], SalesData[West]})
DSUMMARIZE(SalesData, SalesData[Product], "Region", SalesData[North] & SalesData[South] & SalesData[East] & SalesData[West])
Attempts:
2 left
💡 Hint

Think about stacking rows for each region using SELECTCOLUMNS and UNION.

❓ visualization
intermediate
1:30remaining
Best Visualization After Unpivoting Sales Data

After unpivoting regional sales data into Region and Sales columns, which visualization best shows sales comparison across regions for each product?

APie chart showing total sales per product
BLine chart with Region on X-axis and Product as legend
CStacked bar chart with Product on X-axis, Sales on Y-axis, and Region as legend
DTable showing Product, Region, and Sales columns
Attempts:
2 left
💡 Hint

Think about comparing sales by region side by side for each product.

❓ data_modeling
advanced
2:30remaining
Data Model Design for Unpivoted Sales Data

You have unpivoted sales data with columns: Product, Region, and Sales. You want to create a data model that supports filtering by region and product category.

Which modeling approach is best?

ACreate separate dimension tables for Product and Region, and link them to the unpivoted sales fact table
BKeep all data in a single flat table without relationships
CCreate a dimension table only for Product and keep Region as a column in the fact table
DCreate a dimension table only for Region and keep Product as a column in the fact table
Attempts:
2 left
💡 Hint

Think about how to enable flexible filtering and reduce data duplication.

🔧 Formula Fix
advanced
2:00remaining
Identify the Error in Unpivoting DAX Expression

Consider this DAX expression intended to unpivot sales columns:

UNION(
  SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "North", "Sales", SalesData[North]),
  SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "South", SalesData[South]),
  SELECTCOLUMNS(SalesData, "Product", SalesData[Product], "Region", "East", "Sales", SalesData[East])
)

What is the error in this expression?

ASalesData table is not referenced correctly
BUNION cannot combine more than two tables
CSELECTCOLUMNS cannot be used with string literals
DMissing the "Sales" column name in the second SELECTCOLUMNS call
Attempts:
2 left
💡 Hint

Check the column names in each SELECTCOLUMNS call carefully.

🧠 Conceptual
expert
3:00remaining
Why Unpivoting Columns Improves BI Analysis

Why is unpivoting columns into rows often recommended before creating reports and dashboards in BI tools?

AIt converts wide data into a normalized format, enabling easier aggregation, filtering, and visualization
BIt reduces the total number of rows, improving performance
CIt automatically creates calculated columns for each original column
DIt eliminates the need for dimension tables in the data model
Attempts:
2 left
💡 Hint

Think about how BI tools handle data for filtering and grouping.

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