Importing and cleaning data with Power Query
Listen to this lesson
Nigerian voice narration
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.

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.

Try it yourself — step by step
- Home → Get data → Text/CSV and choose disco_billing.csv.
- Click Transform data to open Power Query.
- Check each column's type icon; set Billed and Paid to Whole Number.
- Use Transform → Format → Trim on text columns and Remove Duplicates.
- 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.

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.
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.
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…
