The monthly sales export needs preparation before analysis
You receive a monthly sales export from an operating system. The file contains combined fields, inconsistent text, month columns spread across the worksheet, and coded region values. Your job is to build a preparation process that can be reused next month.
Applied Steps
One reusable queryEach revealed task adds or reuses a recorded transformation step.
Source data
Start with Q1. The second file later adds Q2 columns so you can test refresh behavior.
Sales Data • Q1
| Order_Info | Category | Region_ID | Jan_Sales | Feb_Sales | Mar_Sales |
|---|---|---|---|---|---|
| ORD101-smith | lapTOps | R01 | 1200 | 1500 | 1100 |
| ORD102-JONES | TabLEts | R02 | 800 | 950 | 900 |
| ORD103-davis | monitors | R01 | 450 | 500 | 480 |
Region Mapping
| Region_ID | Region_Name |
|---|---|
| R01 | North America |
| R02 | Europe |
| R03 | Asia Pacific |
| R04 | Latin America |
Updated source • Q2 columns arrive USED IN TASK 5
| Order_Info | Category | Region_ID | Jan_Sales | Feb_Sales | Mar_Sales | Apr_Sales | May_Sales | Jun_Sales |
|---|---|---|---|---|---|---|---|---|
| ORD101-smith | lapTOps | R01 | 1200 | 1500 | 1100 | 1300 | 1400 | 1500 |
Problem → Predict → Reveal → Verify
Make a prediction first. Then reveal the Power Query step and inspect what changed.
Separate Order ID from Salesperson
The source stores two pieces of information in one field: ORD101-smith.
Text formulas such as LEFT, RIGHT, FIND, or TEXTSPLIT can separate the values. That can be useful for worksheet calculations, but here the same imported field must be prepared repeatedly.
| Order ID | Salesperson |
|---|---|
| ORD101 | smith |
Why it matters: the split becomes a recorded query step, so the same transformation can run again when the source is refreshed.
Standardize Category values
The source contains spaces and inconsistent capitalization such as lapTOps .
TRIM and PROPER can clean text in worksheet formulas. Power Query is useful when you want those cleanup steps recorded as part of the import process.
Applied Steps idea: Power Query records each transformation. On refresh, it reruns the sequence in order.
Turn month columns into analysis-ready rows
Jan, Feb, and Mar are repeated measures stored as separate columns. For many analyses, the month should become a field rather than part of the column name.
| Order | Category | Region | Jan | Feb | Mar |
|---|---|---|---|---|---|
| ORD101 | Laptops | R01 | 1200 | 1500 | 1100 |
Jan, Feb, Mar are columns.
Month becomes a field and Sales becomes a value.
Month values become columns again.
Why it matters: unpivoting creates an analysis-ready long table. Pivoting is the reverse operation when a wide presentation is needed. Students should understand both directions, not just memorize the menu command.
Bring Region Name into the sales data
The sales table has Region_ID. The mapping table has Region_ID and Region_Name. The shared key lets Power Query match the records.
| Region_ID |
|---|
| R01 |
| R02 |
| Region_ID | Region_Name |
|---|---|
| R01 | North America |
| R02 | Europe |
Select Region_ID in both tables → choose Left Outer → OK → expand Region_Name.
| Region_ID | Region_Name |
|---|---|
| R01 | North America |
| R02 | Europe |
Left Outer Join, in plain language: keep every sales row and bring in a matching region name when one exists.
Q2 columns arrive: Apr, May, and Jun
The query was designed with Unpivot Other Columns, so the month columns are treated as a changing group rather than individually hard-coded fields.
| Jan | Feb | Mar | Apr | May | Jun |
|---|---|---|---|---|---|
| 1200 | 1500 | 1100 | 1300 | 1400 | 1500 |
Important: this works because the query was designed with Unpivot Other Columns and the source structure expands appropriately. Good query design makes refresh workflows more resilient, but Power Query does not automatically handle every possible structural change.
Complete the five transformations
After all five reveals, the comparison and final takeaway will unlock.
When Should I Use Power Query?
| Need | Excel formulas / worksheet tools | Power Query |
|---|---|---|
| Calculate values in cells | Excellent | Not its primary purpose |
| Interactive worksheet analysis | Excellent | Limited |
| Clean imported data repeatedly | Possible with maintained formulas and steps | Excellent |
| Reshape wide data | Possible | Excellent |
| Combine related tables | Worksheet lookup approaches can work | Merge is designed for this preparation workflow |
| Repeat the same cleaning next month | Requires maintaining worksheet logic | Refresh reruns recorded steps |
| Prepare imported data for analysis | Possible | Excellent |
In real workflows, you will often use both: Power Query prepares the data, and Excel formulas, PivotTables, and charts analyze it.
What you just learned
One combined field into multiple fields.
Dirty text into a consistent standard.
Repeated period columns into analysis-ready rows.
Related tables using a common key.
Run the recorded pipeline again on updated data.