Power Query Interactive Lab

Learn it visually, practice in realistic simulations, predict the result, then finish the workflow in real Excel Power Query.

Core Concepts Visualized

Before you touch the simulators, click "Play Demo" on each card below to see exactly how data moves and transforms.

Unpivot Columns

Wide Data (Input)

ProductJanFeb
Apple1015
Pear2025

Tall Data (Output)

ProductAttributeValue
Click play to watch data move...

Pivot Column

Tall Data (Input)

StoreMetricValue
ASales$50
ACosts$20

Wide Data (Output)

Store......
Click play to reshape...

Group By (Summarize)

Detailed Data (Input)

RegionAmount
North100
North50
North200
RegionTotal (Sum)
Click play to aggregate...

Case 1: The Expense Report

The Analytical Goal

You need a reusable summary of Total Q1 Expenses by Store Location. The reshaped data can also be loaded to Excel for PivotTable analysis.

The Data Problem

"Month" is not a column you can filter by; the months are spread horizontally as headers. You must Unpivot the data, then Group By store.

Store Location Account Name Jan 2026 Feb 2026 Mar 2026
SpokaneRent$5,000$5,000$5,000
SpokanePayroll$12,400$12,100$12,800
SeattleRent$8,500$8,500$8,500
SeattlePayroll$18,200$18,400$19,100
Store Location Account Name Attribute (Month) Value (Amount)
SpokaneRentJan 2026$5,000
SpokaneRentFeb 2026$5,000
SpokaneRentMar 2026$5,000
SpokanePayrollJan 2026$12,400
...
Store Location Total Q1 Expenses
Spokane$52,300
Seattle$81,200
Query Settings

APPLIED STEPS

    Case 2: Logistics Report

    The Analytical Goal

    Calculate exact fleet costs grouped by Location AND Vehicle Type.

    The Data Problem

    The Location and Vehicle are mashed together into one string. You must Split the column first, Unpivot, and do an Advanced Group By.

    Loc_Vehicle Jan 2026 Feb 2026 Mar 2026
    Spokane_Forklift$1,200$1,400$1,300
    Spokane_DeliveryVan$2,500$2,200$2,600
    Seattle_Forklift$1,800$1,900$1,700
    Location Vehicle Jan 2026 Feb 2026 Mar 2026
    SpokaneForklift$1,200$1,400$1,300
    SpokaneDeliveryVan$2,500$2,200$2,600
    SeattleForklift$1,800$1,900$1,700
    Location Vehicle Attribute Value
    SpokaneForkliftJan 2026$1,200
    SpokaneForkliftFeb 2026$1,400
    ...
    Location Vehicle Total Cost
    SpokaneForklift$3,900
    SpokaneDeliveryVan$7,300
    SeattleForklift$5,400
    Query Settings

    APPLIED STEPS

      Case 3: Spokane Hardware POS

      The Analytical Goal

      Find out exactly which products are selling the most by counting the total number of times each unique item was purchased today.

      The Data Problem

      The Point of Sale system lumps all items from a single receipt into one comma-separated cell. You must Split the text, Unpivot the resulting columns, and group them to Count Rows.

      Receipt ID Items
      1001Hammer, Nails
      1002Wrench
      1003Paint, Brushes, Tape
      1004Nails, Tape
      Receipt ID Items.1 Items.2 Items.3
      1001HammerNailsnull
      1002Wrenchnullnull
      1003PaintBrushesTape
      1004NailsTapenull
      Receipt ID Attribute Value (Product)
      1001Items.1Hammer
      1001Items.2Nails
      1002Items.1Wrench
      1003Items.1Paint
      ... remaining items below
      Value (Product) Purchase Count
      Hammer1
      Nails2
      Wrench1
      Paint1
      Brushes1
      Tape2
      Query Settings

      APPLIED STEPS

        Case 4: River City Roasters

        The Analytical Goal

        You want one row per store with separate columns for each inventory item. Because each store-item combination appears more than once, you also need to aggregate those repeated values into a single result.

        The Data Problem

        The inventory system exports tall attribute-value data with repeated Store × Metric combinations. You need to Pivot the Metric column and choose an aggregation function to decide how multiple values should be combined in each output cell.

        Store Metric Value
        DowntownCoffee Beans (lbs)30
        DowntownCoffee Beans (lbs)20
        DowntownMilk (gal)12
        DowntownMilk (gal)8
        ValleyCoffee Beans (lbs)25
        ValleyCoffee Beans (lbs)20
        ValleyMilk (gal)10
        ValleyMilk (gal)8
        Store Coffee Beans (lbs) Milk (gal)
        Downtown5020
        Valley4518
        Query Settings

        APPLIED STEPS

          Aggregation Explorer

          Pivot creates one output cell for each Store × Metric combination. When more than one source row lands in the same cell, Power Query needs an aggregation rule. Change the function below and watch the output.

          Repeated source values
          StoreMetricValue
          DowntownCoffee Beans30
          DowntownCoffee Beans20
          DowntownMilk12
          DowntownMilk8
          ValleyCoffee Beans25
          ValleyCoffee Beans20
          ValleyMilk10
          ValleyMilk8
          Pivot result
          StoreCoffee BeansMilk
          Key idea: Don't Aggregate is appropriate only when each output cell receives at most one source value. Here, every Store × Metric combination has two source rows, so Power Query needs a function such as Sum, Average, Minimum, Maximum, or Count.
          Prediction Challenge

          Predict the table before Power Query builds it

          You have now completed all four practice cases. Study each source dataset and its Power Query settings, then choose the exact output table you think Power Query will create. Submit your prediction to reveal the transformation.

          1 Unpivot Prediction

          Wide → Tall

          Source data

          ProductJanFeb
          Apple1015
          Pear2025

          Power Query setting

          Selected columns: Jan, Feb

          Command: Unpivot Columns

          What will the resulting table look like?

          2 Pivot Prediction

          Tall → Wide + Aggregate

          Source data

          StoreMetricValue
          ASales30
          ASales20
          ACosts8
          ACosts12
          BSales25
          BSales20
          BCosts8
          BCosts10

          Pivot settings

          Pivot column: Metric

          Values column: Value

          Aggregate: Sum

          Store is the remaining column, so it becomes the row identifier.

          Predict the output before running Pivot.

          3 Group By Prediction

          Detail → Summary

          Source data

          RegionAmount
          North100
          North50
          North200
          South80
          South120

          Group By settings

          Group by: Region

          New column: Total Amount

          Operation: Sum

          Column: Amount

          What summary will Group By create?
          Hands-On Excel Practice

          Build the transformation in real Power Query

          The simulations are finished. Now use a compact practice workbook and perform the complete workflow in Excel yourself: Unpivot, Pivot, Unpivot again, Pivot again, then finish with Advanced Group By.

          Practice workbook

          Power_Query_Practice_Workbook.xlsx

          The workbook is embedded in this page. It contains two raw Excel tables plus a data dictionary. Do not reshape the source sheets manually. Perform the work in Power Query.

          Guided data: 32 rows Independent data: 36 rows 2 Pivot + 2 Unpivot workflows

          Open the downloaded file in desktop Excel.

          Rules for this practice

          Work in Power Query. Do not solve the task with worksheet formulas or a PivotTable.

          Keep the raw source unchanged. Your transformation should be repeatable when the source refreshes.

          Use the specified reshape operations. The purpose is to practice Pivot, Unpivot, and Group By.

          Check row counts. Each checkpoint below tells you whether your table shape is still correct.

          Practice 1 · Guided

          Operating Expense Reshape

          Start: 32 rows → Finish: 12 rows

          A regional controller receives one row per Store × Department × Account × Scenario. Monthly Amount and Transaction measures are spread across twelve columns. Build a reusable monthly management summary.

          Starting source

          Raw operating expense export

          Complete source dataset: all 32 of 32 rows from the embedded workbook are included below. Scroll within the table or choose Open full table to inspect every row and column.

          RegionStore_IDStore_NameDepartmentAccount_CodeAccount_NameScenarioJan_AmountJan_TransactionsFeb_AmountFeb_TransactionsMar_AmountMar_Transactions
          WestW01SeattleOperations6100FacilityActual$5,18011$5,40012$5,62013
          WestW01SeattleOperations6100FacilityBudget$5,05010$5,27011$5,49012
          WestW01SeattleOperations6200SuppliesActual$5,63012$5,85013$6,07014
          WestW01SeattleOperations6200SuppliesBudget$5,50011$5,72012$5,94013
          WestW01SeattleSales7100TravelActual$6,08014$6,30015$6,52016
          WestW01SeattleSales7100TravelBudget$5,95013$6,17014$6,39015
          WestW01SeattleSales7200PromotionsActual$6,53015$6,75016$6,97017
          WestW01SeattleSales7200PromotionsBudget$6,40014$6,62015$6,84016
          WestW02PortlandOperations6100FacilityActual$5,53013$5,75014$5,97015
          WestW02PortlandOperations6100FacilityBudget$5,40012$5,62013$5,84014
          WestW02PortlandOperations6200SuppliesActual$5,98014$6,20015$6,42016
          WestW02PortlandOperations6200SuppliesBudget$5,85013$6,07014$6,29015
          WestW02PortlandSales7100TravelActual$6,43016$6,65017$6,87018
          WestW02PortlandSales7100TravelBudget$6,30015$6,52016$6,74017
          WestW02PortlandSales7200PromotionsActual$6,88017$7,10018$7,32019
          WestW02PortlandSales7200PromotionsBudget$6,75016$6,97017$7,19018
          EastE01SpokaneOperations6100FacilityActual$5,88015$6,10016$6,32017
          EastE01SpokaneOperations6100FacilityBudget$5,75014$5,97015$6,19016
          EastE01SpokaneOperations6200SuppliesActual$6,33016$6,55017$6,77018
          EastE01SpokaneOperations6200SuppliesBudget$6,20015$6,42016$6,64017
          EastE01SpokaneSales7100TravelActual$6,78018$7,00019$7,22020
          EastE01SpokaneSales7100TravelBudget$6,65017$6,87018$7,09019
          EastE01SpokaneSales7200PromotionsActual$7,23019$7,45020$7,67021
          EastE01SpokaneSales7200PromotionsBudget$7,10018$7,32019$7,54020
          EastE02BoiseOperations6100FacilityActual$6,23017$6,45018$6,67019
          EastE02BoiseOperations6100FacilityBudget$6,10016$6,32017$6,54018
          EastE02BoiseOperations6200SuppliesActual$6,68018$6,90019$7,12020
          EastE02BoiseOperations6200SuppliesBudget$6,55017$6,77018$6,99019
          EastE02BoiseSales7100TravelActual$7,13020$7,35021$7,57022
          EastE02BoiseSales7100TravelBudget$7,00019$7,22020$7,44021
          EastE02BoiseSales7200PromotionsActual$7,58021$7,80022$8,02023
          EastE02BoiseSales7200PromotionsBudget$7,45020$7,67021$7,89022

          Final table

          Management summary after Group By

          Complete final result: all 12 of 12 rows. One row per Region × Department × Month, with the four measures summed across stores and accounts.

          RegionDepartmentMonthActual_AmountBudget_AmountActual_TransactionsBudget_Transactions
          WestOperationsJan$22,320$21,8005046
          WestOperationsFeb$23,200$22,6805450
          WestOperationsMar$24,080$23,5605854
          WestSalesJan$25,920$25,4006258
          WestSalesFeb$26,800$26,2806662
          WestSalesMar$27,680$27,1607066
          EastOperationsJan$25,120$24,6006662
          EastOperationsFeb$26,000$25,4807066
          EastOperationsMar$26,880$26,3607470
          EastSalesJan$28,720$28,2007874
          EastSalesFeb$29,600$29,0808278
          EastSalesMar$30,480$29,9608682

          Step-by-step directions

          1
          Load the source table

          Open Practice_Expense_Export. Click anywhere inside ExpenseExportTable, then choose Data → From Table/Range. Rename the query Expense_Practice.

          Checkpoint: 32 rows and 13 columns.

          2
          Unpivot all monthly measure columns

          Select the seven identifier columns Region, Store_ID, Store_Name, Department, Account_Code, Account_Name, Scenario. Choose Transform → Unpivot Columns → Unpivot Other Columns.

          The six monthly measure columns become two columns named Attribute and Value.

          Checkpoint: 192 rows and 9 columns.

          3
          Split the combined month/measure label

          Select Attribute. Choose Transform → Split Column → By Delimiter. Use underscore _ as the delimiter and split at the left-most delimiter. Rename the two new columns Month and Measure.

          You should now see Month values such as Jan and Feb, and Measure values such as Amount and Transactions.

          Checkpoint: still 192 rows.

          4
          Pivot Measure into Amount and Transactions

          Select Measure and choose Transform → Pivot Column. Use Value as the Values Column. Under Advanced options choose Don't Aggregate.

          The values Amount and Transactions become separate columns.

          Checkpoint: 96 rows. You should have separate Amount and Transactions columns.

          5
          Unpivot Amount and Transactions again

          Select the Amount and Transactions columns. Choose Transform → Unpivot Columns. Rename the new Attribute column to Measure. Leave the numeric column named Value.

          Checkpoint: 192 rows again.

          6
          Create the Pivot key

          Select Scenario first and Measure second. Choose Transform → Merge Columns. Use underscore _ as the separator and name the new column Scenario_Measure.

          You should see four possible labels: Actual_Amount, Actual_Transactions, Budget_Amount, Budget_Transactions.

          7
          Pivot Scenario_Measure into four analysis columns

          Select Scenario_Measure and choose Transform → Pivot Column. Use Value as the Values Column and choose Don't Aggregate.

          You now have one row per Store × Department × Account × Month with four analysis columns.

          Checkpoint: 48 rows.

          8
          Finish with Advanced Group By

          Choose Home → Group By, then switch to Advanced. Group by Region, Department, and Month. The order of the grouping fields does not change the grouping result.

          Add four aggregations, all using Sum:

          • Actual_Amount → Sum of Actual_Amount
          • Budget_Amount → Sum of Budget_Amount
          • Actual_Transactions → Sum of Actual_Transactions
          • Budget_Transactions → Sum of Budget_Transactions

          Final checkpoint: 12 rows and 7 columns.

          9
          Set types, sort, and load

          Set Amount columns to an appropriate numeric/currency type and Transaction columns to Whole Number. Sort Region, Department, and Month as desired. Choose Home → Close & Load to return the summary to Excel.

          Self-check after you finish

          Your final query should contain 12 rows.

          For West · Operations · Jan: Actual Amount = $22,320; Budget Amount = $21,800; Actual Transactions = 50; Budget Transactions = 46.

          Grand totals across the final table: Actual Amount = $316,800; Budget Amount = $310,560; Actual Transactions = 816; Budget Transactions = 768.

          Practice 2 · Independent Transfer

          Sales Performance Reshape

          Start: 36 rows → Finish: 18 rows

          Use the same reshape logic on a different business problem. The source contains Revenue and Units by month, Channel, Product Family, Store, and Scenario.

          Goal

          Create one row per Region × Channel × Month with Actual_Revenue, Budget_Revenue, Actual_Units, Budget_Units.

          Starting source

          Raw sales performance export

          Complete source dataset: all 36 of 36 rows from the embedded workbook are included below. Scroll within the table or choose Open full table to inspect every row and column.

          RegionStore_IDStore_NameChannelProduct_CodeProduct_FamilyScenarioJan_RevenueJan_UnitsFeb_RevenueFeb_UnitsMar_RevenueMar_Units
          WestS01SeattleIn StoreP100AccessoriesActual$8,30083$8,80088$9,30093
          WestS01SeattleIn StoreP100AccessoriesBudget$8,10081$8,60086$9,10091
          WestS01SeattleIn StoreP200HardwareActual$9,50095$10,000100$10,500105
          WestS01SeattleIn StoreP200HardwareBudget$9,30093$9,80098$10,300103
          WestS01SeattleIn StoreP300ServicesActual$10,700107$11,200112$11,700117
          WestS01SeattleIn StoreP300ServicesBudget$10,500105$11,000110$11,500115
          WestS01SeattleOnlineP100AccessoriesActual$9,10091$9,60096$10,100101
          WestS01SeattleOnlineP100AccessoriesBudget$8,90089$9,40094$9,90099
          WestS01SeattleOnlineP200HardwareActual$10,300103$10,800108$11,300113
          WestS01SeattleOnlineP200HardwareBudget$10,100101$10,600106$11,100111
          WestS01SeattleOnlineP300ServicesActual$11,500115$12,000120$12,500125
          WestS01SeattleOnlineP300ServicesBudget$11,300113$11,800118$12,300123
          CentralS02DenverIn StoreP100AccessoriesActual$9,60093$10,10098$10,600103
          CentralS02DenverIn StoreP100AccessoriesBudget$9,40091$9,90096$10,400101
          CentralS02DenverIn StoreP200HardwareActual$10,800105$11,300110$11,800115
          CentralS02DenverIn StoreP200HardwareBudget$10,600103$11,100108$11,600113
          CentralS02DenverIn StoreP300ServicesActual$12,000117$12,500122$13,000127
          CentralS02DenverIn StoreP300ServicesBudget$11,800115$12,300120$12,800125
          CentralS02DenverOnlineP100AccessoriesActual$10,400101$10,900106$11,400111
          CentralS02DenverOnlineP100AccessoriesBudget$10,20099$10,700104$11,200109
          CentralS02DenverOnlineP200HardwareActual$11,600113$12,100118$12,600123
          CentralS02DenverOnlineP200HardwareBudget$11,400111$11,900116$12,400121
          CentralS02DenverOnlineP300ServicesActual$12,800125$13,300130$13,800135
          CentralS02DenverOnlineP300ServicesBudget$12,600123$13,100128$13,600133
          EastS03BostonIn StoreP100AccessoriesActual$10,900103$11,400108$11,900113
          EastS03BostonIn StoreP100AccessoriesBudget$10,700101$11,200106$11,700111
          EastS03BostonIn StoreP200HardwareActual$12,100115$12,600120$13,100125
          EastS03BostonIn StoreP200HardwareBudget$11,900113$12,400118$12,900123
          EastS03BostonIn StoreP300ServicesActual$13,300127$13,800132$14,300137
          EastS03BostonIn StoreP300ServicesBudget$13,100125$13,600130$14,100135
          EastS03BostonOnlineP100AccessoriesActual$11,700111$12,200116$12,700121
          EastS03BostonOnlineP100AccessoriesBudget$11,500109$12,000114$12,500119
          EastS03BostonOnlineP200HardwareActual$12,900123$13,400128$13,900133
          EastS03BostonOnlineP200HardwareBudget$12,700121$13,200126$13,700131
          EastS03BostonOnlineP300ServicesActual$14,100135$14,600140$15,100145
          EastS03BostonOnlineP300ServicesBudget$13,900133$14,400138$14,900143

          Final table

          Region × Channel × Month summary

          Complete expected shape: all 18 of 18 final rows are shown. Your Power Query result should contain these seven columns after the final Group By.

          RegionChannelMonthActual_RevenueBudget_RevenueActual_UnitsBudget_Units
          WestIn StoreJan$28,500$27,900285279
          WestIn StoreFeb$30,000$29,400300294
          WestIn StoreMar$31,500$30,900315309
          WestOnlineJan$30,900$30,300309303
          WestOnlineFeb$32,400$31,800324318
          WestOnlineMar$33,900$33,300339333
          CentralIn StoreJan$32,400$31,800315309
          CentralIn StoreFeb$33,900$33,300330324
          CentralIn StoreMar$35,400$34,800345339
          CentralOnlineJan$34,800$34,200339333
          CentralOnlineFeb$36,300$35,700354348
          CentralOnlineMar$37,800$37,200369363
          EastIn StoreJan$36,300$35,700345339
          EastIn StoreFeb$37,800$37,200360354
          EastIn StoreMar$39,300$38,700375369
          EastOnlineJan$38,700$38,100369363
          EastOnlineFeb$40,200$39,600384378
          EastOnlineMar$41,700$41,100399393
          1. 1. Load: Open Challenge_Sales_Export and load SalesExportTable into Power Query. Start with 36 rows.
          2. 2. First Unpivot: Keep Region through Scenario as identifiers and use Unpivot Other Columns. You should have 216 rows.
          3. 3. Split: Split Attribute at _ into Month and Measure. Measure should contain Revenue and Units.
          4. 4. First Pivot: Pivot Measure using Value, with Don't Aggregate. You should have 108 rows and separate Revenue and Units columns.
          5. 5. Second Unpivot: Unpivot Revenue and Units. Rename Attribute to Measure. You should return to 216 rows.
          6. 6. Build key: Merge Scenario and Measure with _ to create Scenario_Measure.
          7. 7. Second Pivot: Pivot Scenario_Measure using Value and Don't Aggregate. You should have 54 rows.
          8. 8. Advanced Group By: Group by Region, Channel, Month. Sum Actual_Revenue, Budget_Revenue, Actual_Units, and Budget_Units. Your final result should have 18 rows.
          9. 9. Finish: Set data types, sort as desired, and Close & Load.
          Independent challenge self-check

          Final row count: 18.

          For West · In Store · Jan: Actual Revenue = $28,500; Budget Revenue = $27,900; Actual Units = 285; Budget Units = 279.

          Grand totals: Actual Revenue = $631,800; Budget Revenue = $621,000; Actual Units = 6,156; Budget Units = 6,048.