By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For Power BI Engineers & PL-300 Exam Prep)
Power Query Editor is where 90% of Power BI data transformation happens—before your data even hits the model. Think of it like a data assembly line: - Raw materials (source data) go in (CSV, SQL, API, Excel, etc.).- Applied Steps are the workstations that clean, reshape, and filter the data.- M language is the blueprint that tells each workstation exactly what to do.
Why this matters in production:- Broken transformations = broken reports. If you don’t understand Applied Steps, you’ll waste hours debugging why a column disappeared or why a merge failed.- M is your escape hatch. When the UI can’t do what you need (e.g., custom logic, API pagination, or complex joins), M lets you write your own rules.- Performance killer: Poorly structured M queries can slow down refreshes by 10x (or crash Power BI entirely). A single inefficient step can turn a 2-minute refresh into a 20-minute nightmare.- Collaboration & maintenance: If you leave a query with 50 unnamed steps like "Changed Type1," "Filtered Rows2," etc., your teammates (or future you) will hate you. Clean, documented steps = scalable Power BI.
Real-world scenario:You inherit a Power BI report with 12 data sources, 30+ Applied Steps, and no documentation. The refresh fails with a cryptic error: Expression.Error: The column 'CustomerID' of the table wasn't found. Where do you even start? This guide gives you the tools to diagnose, fix, and prevent this.
Expression.Error: The column 'CustomerID' of the table wasn't found.
// SQL equivalent SELECT * FROM Source WHERE Status = 'Active' ``` Key difference: M doesn’t optimize queries like SQL does. You must write efficient code.
The name 'OldColumnName' wasn't recognized
Table.Buffer()
StartDate
API_Key
Filter = "2023-01-01"
try-catch
try ... otherwise
powerquery-m try [Column1] / [Column2] otherwise null
123
"123"
null
""
Table.TransformColumnTypes
Sales = SalesRaw
SalesClean = Table.TransformColumns(Sales, ...)
Expression.Error: The column 'ProductID' of the table wasn't found.
powerquery-m = Table.RenameColumns(#"Removed Columns",{{"ProductNumber", "ProductID"}})
ProductNumber
ProductID
Merged Queries
powerquery-m = Table.NestedJoin(#"Renamed Columns", {"ProductNumber"}, Products, {"ProductNumber"}, "Products", JoinKind.LeftOuter)
powerquery-m = Table.NestedJoin(#"Renamed Columns", {"ProductID"}, Products, {"ProductNumber"}, "Products", JoinKind.LeftOuter)
let ... in
Table.Profile()
View Native Query
powerquery-m = Table.AddColumn(#"Previous Step", "ProfitMargin", each [Profit] / [Revenue])
[Revenue] = 0
powerquery-m = Table.AddColumn(#"Previous Step", "ProfitMargin", each try [Profit] / [Revenue] otherwise null)
Changed Type1
Set Data Types
Filtered Rows
Filter Active Customers
Filters out inactive customers (Status = "Inactive"). Applied before merging to reduce data volume.
powerquery-m = Table.ReplaceValue(#"Previous Step", each [SSN], each Text.Repeat("*", Text.Length([SSN])), Replacer.ReplaceValue, {"SSN"})
Filter Rows
Remove Columns
Table.SelectRows
Table.Filter
Filter 2023 Sales
Filtered Rows1
RegionFilter
fn_CleanCustomerName
powerquery-m = Table.AddColumn(#"Previous Step", "Error", each try [Calculation] otherwise "Error: " & Error.Record[Message])
The column 'X' wasn't found
Filter = "2023"
Filter = Date.Year(Parameter_StartDate)
We cannot convert the value null to type Logical
"A query fails with The column 'CustomerID' wasn't found. What’s the most likely cause?"
The column 'CustomerID' wasn't found
CustomerID
M Language Syntax
"Which M function removes duplicate rows?"
Table.Distinct()
Table.RemoveDuplicates()
Query Folding
"Which of these steps will not fold to SQL Server?"
Table.SelectRows()
Table.SelectColumns()
Error Handling
"How do you handle division by zero in M?"
try [Numerator] / [Denominator] otherwise null
if [Denominator] = 0 then null else [Numerator] / [Denominator]
Parameters vs. Hardcoding
Parameter_StartDate
You have a table with a Date column. Write an M query that: 1. Adds a new column called IsWeekend (returns true if the date is Saturday/Sunday).2. Handles nulls (returns null if Date is null).
Date
IsWeekend
true
= Table.AddColumn( #"Previous Step", "IsWeekend", each if [Date] = null then null else if Date.DayOfWeek([Date], Day.Sunday) = 0 or Date.DayOfWeek([Date], Day.Sunday) = 6 then true else false )
Why it works:- Date.DayOfWeek([Date], Day.Sunday) returns 0 for Sunday, 6 for Saturday.- The if [Date] = null check prevents errors.
Date.DayOfWeek([Date], Day.Sunday)
0
6
if [Date] = null
Table.SelectRows(Source, each [Status] = "Active")
Table.SelectColumns(Source, {"Col1", "Col2"})
Table.RenameColumns(Source, {{"Old", "New"}})
Table.AddColumn(Source, "NewCol", each [Col1] + [Col2])
Table.TransformColumnTypes(Source, {{"Col1", type number}})
Table.NestedJoin(Source, {"Key"}, OtherTable, {"Key"}, "NewCol", JoinKind.LeftOuter)
Table.Group(Source, {"GroupCol"}, {{"Sum", each List.Sum([Value]), type number}})
try [Calculation] otherwise null
Table.Buffer(Source)
Table.Distinct(Source)
Power Query is a pipeline, not a one-time script.- Test early, test often.- Document every step.- Assume the next person maintaining your query is a sleep-deprived version of you.
Now go break something (intentionally)—then fix it. That’s how you learn. ?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.