Domain 1 β€” Module 4 of 7 57%
4 of 26 overall
Domain 1: Prepare the Data Free ⏱ ~14 min read

Power Query Transforms

Master the essential Power Query transformations β€” data types, custom columns, group by, pivot, unpivot, and transpose β€” that appear on every PL-300 exam.

Reshaping data in Power Query

Simple explanation

Think of Power Query as a kitchen prep station.

Raw ingredients (your data) arrive in all shapes: some need chopping (splitting columns), some need combining (merging columns), some need rearranging (pivoting rows into columns). You prep everything before it goes into the pan (your data model).

This module covers the core transformations you’ll use on almost every Power BI project: setting data types, creating new columns, grouping rows, and reshaping data with pivot, unpivot, and transpose.

Setting the right data types

Data types are the foundation. If a number column is typed as Text, you can’t sum it. If a date column is typed as Text, time intelligence won’t work.

Data TypeUse ForExample
Whole NumberCounts, IDs, quantitiesOrderQuantity: 42
Decimal NumberMoney, percentages, measurementsRevenue: 1234.56
TextNames, codes, categoriesProductName: β€œOrganic Avocado”
DateDates without timeOrderDate: 2026-04-15
Date/TimeTimestamps with time componentCreatedAt: 2026-04-15 14:30:00
True/FalseBoolean flagsIsActive: TRUE

How to change: Click the type icon in the column header, or select the column β†’ Transform β†’ Data Type.

Exam tip: locale and data types

Date parsing depends on your locale setting. β€œ04/06/2026” is April 6 in the US (MM/DD) but June 4 in most other countries (DD/MM). If dates look wrong after import, check File β†’ Options β†’ Regional Settings in Power Query, or use β€œUsing Locale” when changing the data type to specify the correct format.

Creating and transforming columns

Riley at Coastal Fresh (πŸ›’) needs to calculate profit per product. The source data has Revenue and Cost columns but no Profit column.

Custom Column vs Conditional Column

MethodWhen to UseExample
Custom ColumnCalculate a value using a formulaProfit = [Revenue] - [Cost]
Conditional ColumnAssign values based on conditions (like IF)If Revenue > 10000 then β€œHigh” else β€œLow”
Column from ExamplesPower Query infers the pattern from your examplesType β€œQ1” for Jan, β€œQ1” for Feb β€” PQ figures out the quarter logic

Custom Column uses M language syntax:

  • Add Column β†’ Custom Column
  • Formula: [Revenue] - [Cost]

Conditional Column uses a visual IF builder:

  • Add Column β†’ Conditional Column
  • If [Region] equals β€œNorth” then β€œNZ North” else if [Region] equals β€œSouth” then β€œNZ South”

Other common column transforms

TransformWhat It DoesWhere
Split ColumnBreak one column into multiple (by delimiter, character count, etc.)Transform or Right-click
Merge ColumnsCombine two+ columns into oneTransform β†’ Merge Columns
ExtractPull out part of text (first/last characters, between delimiters)Transform β†’ Extract
Replace ValuesSwap specific values for othersRight-click β†’ Replace Values

Group By: aggregating rows

Group By collapses many rows into summary rows. It’s the Power Query equivalent of a SQL GROUP BY.

Nadia at Prism Agency (πŸ“Š) has a table with one row per ad impression β€” 2 million rows. She doesn’t need impression-level detail for her dashboard. She uses Group By to aggregate:

  • Group by: Campaign, Platform
  • Aggregations: Sum of Impressions, Sum of Clicks, Sum of Spend

Result: 2 million rows collapse to ~150 rows (one per campaign-platform combination).

How to: Select columns β†’ Transform β†’ Group By β†’ choose Basic or Advanced β†’ add aggregation columns.

Basic vs Advanced Group By

Basic: Group by one column, one aggregation. Advanced: Group by multiple columns, multiple aggregations (sum, count, average, min, max, etc.).

Always use Advanced when you need more than one summary column β€” it saves you from doing multiple Group By steps.

Pivot, Unpivot, and Transpose

These three operations reshape your data structure. They sound similar but do very different things.

Pivot makes tables wider, Unpivot makes them longer, Transpose rotates them
OperationWhat It DoesWhen to Use It
PivotTurns row values into column headers (long β†’ wide)Monthly data in rows needs to become Jan, Feb, Mar columns
UnpivotTurns column headers into row values (wide β†’ long)Months as separate columns need to become a single 'Month' column with values
TransposeFlips rows and columns entirely (rotates the table 90Β°)A table where headers are in the first column instead of the first row

Unpivot: the most common exam scenario

Kenji at Apex Manufacturing (🏭) receives a spreadsheet where production data is laid out wide:

FactoryJanFebMarApr
Tokyo1200135011001400
Shanghai8009508701020

This is great for humans to read but terrible for Power BI. He needs a long format for time intelligence:

FactoryMonthProduction
TokyoJan1200
TokyoFeb1350
ShanghaiJan800

How to Unpivot:

  1. Select the columns to keep fixed (Factory)
  2. Select the month columns β†’ Right-click β†’ Unpivot Columns
  3. Rename the generated β€œAttribute” and β€œValue” columns to β€œMonth” and β€œProduction”
Exam tip: Unpivot Columns vs Unpivot Other Columns
  • Unpivot Columns: Unpivots only the selected columns. If new months are added to the source, they won’t be included.
  • Unpivot Other Columns: Unpivots everything EXCEPT the selected columns. New months added to the source ARE automatically included.

On the exam, Unpivot Other Columns is almost always the better answer because it handles future data gracefully.

Pivot: the reverse operation

Pivot turns long data into wide format. Use it when you need values from a column to become separate columns β€” for example, turning a β€œMetric” column with values β€œRevenue”, β€œCost”, β€œProfit” into three separate columns.

Transpose: rotating the entire table

Transpose flips rows and columns entirely β€” rotating the table 90 degrees. Use it when your data arrives with headers in the first column instead of the first row.

Kenji receives a summary table where metric names are in column A and months are rows:

Values
Revenue1200
Cost800
Profit400

After Transpose (Transform β†’ Transpose), each metric becomes a column header:

RevenueCostProfit
1200800400

After transposing, you typically need to Use First Row as Headers (Transform β†’ Use First Row as Headers) to promote the first data row into column names.

Knowledge check

Question

What's the difference between a Custom Column and a Conditional Column?

Click or press Enter to reveal answer

Answer

Custom Column uses M formula syntax for calculations (e.g., [Revenue] - [Cost]). Conditional Column uses visual IF/THEN logic to assign values based on conditions.

Click to flip back

Question

What does Unpivot do?

Click or press Enter to reveal answer

Answer

Turns column headers into row values β€” converting a wide table into a long table. Essential for time series data where months/years are separate columns.

Click to flip back

Question

Why is 'Unpivot Other Columns' usually better than 'Unpivot Columns'?

Click or press Enter to reveal answer

Answer

Unpivot Other Columns unpivots everything except the selected columns. If new columns are added to the source (e.g., new months), they're automatically included in the unpivot.

Click to flip back

Knowledge Check

Kenji receives factory production data with months as column headers (Jan, Feb, Mar...). He needs to create a time series chart. What Power Query operation should he use?

Knowledge Check

Riley notices that her 'OrderDate' column shows dates as '15/04/2026' but Power BI parsed them as '04/15/2026' (swapping day and month). What's the most likely cause?

Next up: Combining Data: Merge, Append and Queries β€” bring data from multiple tables together.