← Power BI Dashboards track
Lesson 2 of 6 · 8 min

Importing and cleaning data with Power Query

Listen

Nigerian voice narration

Scenario

Fictional training case. The billing export arrives monthly from the DisCo's system, and it is never clean: district names in three spellings, consumption stored as text, blank payment cells, and a header banner row above the real headers. In Excel you cleaned by hand; in Power BI, Power Query records your cleaning steps and replays them automatically on next month's file.

An analyst presenting an interactive dashboard

Meet the Power Query Editor

When importing, choose Transform Data instead of Load. The Power Query Editor opens — a workshop where every cleaning action you take is recorded as a step in the Applied Steps pane on the right. Steps replay in order, every refresh.

Power Query Editor with disco_billing loaded and the Applied steps list.
On screen: Power Query Editor with disco_billing loaded and the Applied steps list. Uses the course practice file · tap to enlarge.

Try it yourself — step by step

  1. Home → Get data → Text/CSV and choose disco_billing.csv.
  2. Click Transform data to open Power Query.
  3. Check each column's type icon; set Billed and Paid to Whole Number.
  4. Use Transform → Format → Trim on text columns and Remove Duplicates.
  5. Click Close & Apply.

The everyday cleaning moves

Promote the real header row (Use First Row as Headers). Set each column's data type (whole number, decimal, date, text). Remove duplicates. Replace blank payments with 0. Trim and capitalise district names so 'jos', 'JOS' and 'Jos' become one.

Split, merge and rename

Split Column by delimiter separates combined fields like 'Jos-North'. Rename columns to clear names — Billed_NGN beats Column7. Every rename and split is a recorded step, so document your logic by keeping step names meaningful.

Colleagues checking an AI response against source documents
Prompt practice

Build the prompt from three phrases — Role, Task and Format — and watch the AI answer.

Why steps beat manual cleaning

Next month the new export arrives with the same problems. You drop it in, hit Refresh, and every cleaning step replays in seconds. Manual Excel cleaning must be redone each month; Power Query is done once. This is the single biggest time-saver in Power BI.

Common mistakes to avoid

The classic mistake is clicking Load instead of Transform Data, then trying to clean inside the report where nothing is recorded. Another is deleting Applied Steps to 'tidy up' — those steps are your cleaning pipeline, and deleting them deletes the cleaning. A third is leaving blanks as nulls, which silently poison sums and averages; replace them with 0 where that is the true meaning. And test the refresh: drop in last month's file and confirm the steps replay.

Your practice

Import the sample billing CSV with Transform Data. Promote headers, set data types, replace blank Paid values with 0, and standardise one text column. Close & Apply, then check the table view. You have built a repeatable cleaning pipeline.

Try this prompt

You are a Power BI expert. List the Power Query steps to clean a monthly billing export that has a banner row above the headers, text-formatted numbers, blank payment cells and inconsistent district spellings, in the correct order.

Follow-along sample data
DisCo billing records (CSV)
Download
Checkpoint · 3 questions

Answer all three questions and check your answers to unlock the next lesson. Pass mark: 2 of 3.

Applied Steps in Power Query are…

Blank payment cells should be…

'jos', 'JOS' and 'Jos' in one column will…