🚀 New batches open: Advanced Excel • Power BI • SQL • AI for Analytics — Book a free demo

Day 2 — Power Query — getting data in and cleaning it

The step that happens before any measure runs. Get it right and everything downstream is easier.

What Power Query is for

Power Query is the loading dock. Data arrives messy, and Power Query fixes it once, at refresh time, before the model ever sees it. Every fix you make is recorded as a step, and those steps replay automatically next month on next month’s file.

This is the part that saves the most time Not the visuals. If a report takes you three hours a month, most of that is cleaning — and Power Query turns it into one click, permanently.

The Applied Steps list

Everything you click is written down on the right of the Power Query window, in order:

Source Promoted Headers Changed Type Removed Other Columns Filtered Rows Renamed Columns

You can click any step to see the table as it was at that moment, reorder them, or delete one. This is version control for your cleaning, and it is why Power Query beats doing the same work by hand in Excel.

The steps worth knowing on day one

StepWhat it fixes
Promote HeadersThe first row is really the column names
Change TypeDates loaded as text, numbers loaded as text
Remove ColumnsThe 40 columns nobody asked for
Filter RowsCancelled orders, test records, blank rows
Replace Values"N/A" where a number should be
Trim / CleanStray spaces that break relationships
Split Column"DL-2024-0912" into three usable fields
Group ByCollapsing detail you do not need

Change Type is the one that bites

A date stored as text is not a date It will still display as 05-01-2025. It will still sort. But time intelligence will fail, relationships to a date table will not form, and the error message you get will be about something else entirely. When a report behaves strangely, check your types first.

The same applies to numbers. A column of amounts loaded as text sums to nothing at all, silently.

Remove columns early, and be ruthless

Every column you keep costs memory and refresh time. A common source export has sixty columns; a report usually needs eight.

Remove, do not hide Hiding a column in the report view still loads it into memory. Removing it in Power Query means it never arrives. On a large model this is the difference between a file that opens in four seconds and one that opens in forty.

Filter rows early too

If the report only covers the last two financial years, filter to that in Power Query rather than loading eleven years and filtering in a visual. The rule is the same: the earlier you throw data away, the faster everything downstream becomes.

Why not just do it in DAX?

You often can. You usually should not.

JobWhere it belongsWhy
Removing columnsPower QueryRuns once at refresh
Fixing data typesPower QueryThe model needs them right
Splitting a code into partsPower QueryStored once, not recomputed
Combining two filesPower QueryAppend and Merge exist for this
Total salesDAX measureMust react to slicers
% of totalDAX measureDepends on what is filtered
Year-on-year growthDAX measureDepends on the visual

The dividing line: if the answer changes when someone clicks a slicer, it must be a measure. If it is the same every time, do it in Power Query.

Checking your work

After cleaning, the model here holds 48 sales rows. A quick row count is the cheapest sanity check there is:

Always count rows after a refresh If last month was 45,000 rows and this month is 12, the source changed and nobody told you. A row-count card on a hidden page has saved more reports than any visual on the front page.

Try these yourself

  1. List the Applied Steps you would use to load a CSV whose first row is the header and whose date column arrives as text.
  2. Explain why removing a column beats hiding it.
  3. Decide where "profit margin percentage" belongs — Power Query or DAX — and say why.
  4. Count the rows in the Calendar table.
  5. Name the one check you should run after every refresh.