Sub topic 1
Tour of the Power Query Editor
Prerequisites
Assume you know basic Power BI Desktop, tables, rows, columns, and common data types. You should also be able to connect Power BI to a CSV or Excel file.
Tour of the Power Query Editor
Open Power Query Editor with Home > Transform data. The main areas are:
- The Queries pane lists source queries.
- The data preview shows the current table.
- The ribbon contains transformation commands.
- The Applied Steps pane records each transformation.
- The formula bar shows the M expression for the selected step.
The preview is not the final model. It shows how the query will look when Power BI evaluates it.
Applied Steps and the M code behind them
An applied step is a saved transformation. Selecting a step lets you inspect its result. Steps run from top to bottom, so changing an early step can affect every later step.
Power Query uses M, a language for describing data transformations. The editor writes most M code for you. The formula bar lets you read it and make small edits.
let
Source = #table({"OrderID", "Amount"}, {{1, "120"}}),
ChangedType = Table.TransformColumnTypes(
Source,
{{"OrderID", Int64.Type}, {"Amount", type number}},
"en-US"
)
in
ChangedTypeHere, Source creates a table, and ChangedType converts the columns. The in line returns the final step.
Profiling data: column quality, distribution, and profile
Use the View tab to enable column quality, column distribution, and column profile. These tools help you find problems before transforming data:
- Column quality shows valid, empty, and error values.
- Column distribution shows distinct and unique values.
- Column profile summarizes values and statistics.
Check whether the profile covers the entire dataset or only the top 1,000 rows. Change the setting when rare errors may occur later in the file.
Promoting headers and removing junk rows
If a file begins with title lines or notes, remove those rows first with Remove Rows > Remove Top Rows. Then use Use First Row as Headers. Promoting headers gives columns meaningful names instead of generic names such as Column1.
Setting data types and locale
Set types early. A data type defines how Power Query interprets a value, such as text, whole number, decimal number, date, or date/time.
For dates and numbers, choose Change Type > Using Locale when the source format depends on regional settings. For example, 31/12/2026 requires a day-first locale. Explicit locale settings make refreshes consistent across computers.
Exercise
Why should you inspect Applied Steps and set a locale when importing dates?
Show answer
Steps run in order, and an explicit locale prevents machine-specific date interpretation.