Prompts for cleaning data: start with the verb

A good cleaning prompt starts with what to do, says what to change and what must stay. Every verb in it maps to a Power Query step you can check.

Short answer: start each request with the verb (remove, split, replace, merge, change type), name the column, and say what must stay unchanged: "Split the FullName column into FirstName and LastName at the last space; keep every other column as it is." Ask for the result as Power Query steps (M code) instead of a cleaned file, so the cleaning runs again on next month's data and you can read every step.

"Clean this data" lets the AI decide what clean means, and it may change more than you wanted. "Trim the spaces in Customer, keep every other column as it is" changes one thing. The shape is always the same: one verb, one target, and a line about what stays.

Which verbs map to which step?

VerbExample requestPower Query step
RemoveRemove rows where OrderID is blankTable.SelectRows
Remove duplicatesRemove duplicate rows by OrderID, keep the firstTable.Distinct
SplitSplit FullName at the last spaceTable.SplitColumn
ReplaceReplace "N/A" with null in RegionTable.ReplaceValue
TrimTrim spaces in CustomerNameTable.TransformColumns with Text.Trim
Change typeMake OrderDate a date, using the en-GB localeTable.TransformColumnTypes
MergeMerge Orders with Customers on CustomerID, left outerTable.NestedJoin
Cleaning verbs and their Power Query steps

What does one request look like?

In Power Query (M), on the table Orders:
1. Remove rows where OrderID is blank.
2. Trim spaces in CustomerName.
3. Change OrderDate to a date using the en-GB locale (dates are written 31/12/2026).
Keep all other columns and their order unchanged.
Return the steps as M code I can paste into the Advanced Editor, one step per line.

Numbering the steps gives you one applied step each in Power Query, so you can click through them and see what each one did.

Why steps and not a cleaned file?

  • They run again. Next month's export goes through the same steps on refresh.
  • You can read them. Each applied step shows its result in the preview.
  • No data leaves. You describe the columns; the data never has to go into the chat.

What goes wrong?

  • No locale on dates. "03/04/2026" is March in one country and April in another.
  • "Clean this up." The AI decides what dirty means. Name each step.
  • Removing rows silently. Before a Remove step, count the rows it removes and check they are the ones you meant.

Where can you check this?

Where do you start?

Keep the steps foldable to the source where you can: see query folding explained. For the prompt shape behind this, see few-shot prompts.

Keep reading

More from the blog.

Every post

Next

Building this? Say hello.

A question about this post, a pattern you would build differently, or the next thing you want written out: Behnia reads every message.