Skip to content
BENIBIX Learn

Power Query

Also known as Microsoft Power Query, Power Query Editor, Power Query M

A Microsoft tool in Excel and Power BI that gets and cleans data. It saves each step.

Think of it like

It is like a recipe card. You write the steps once, then use them for each new batch.

Example

Each month Emma gets a sales CSV with the same mess. She cleans it once in Power Query. Now each new file takes one click on Refresh.

Why it matters

It turns hours of copy and paste into one click. The steps are the same every time, so fewer mistakes slip in.

Definition

Power Query is Microsoft's tool for getting and cleaning data. It is built into Excel and Power BI. You connect to a source, like a file or a database. Then you click through steps, such as removing columns or filtering rows. Each step is saved and written in a language called M. When new data arrives, one refresh runs every step again.

Example code

powerquery
let
    Source = Csv.Document(File.Contents("C:\data\sales.csv")),
    Headers = Table.PromoteHeaders(Source),
    North = Table.SelectRows(Headers, each [region] = "North")
in
    North
Three clicked steps, written in M. The editor writes this for you as you click.
Clean the data once as steps. Each refresh runs the same steps on the new data.

Common mistake

Fixing the data by hand in the sheet after loading it. Hand edits are lost on the next refresh.

Key takeaways

  1. 1
    Steps, not edits. Each change is saved as a step.
  2. 2
    Refresh repeats. New data runs the same steps.
  3. 3
    Written in M. Every click becomes a line of code.

Compare