# Power Query

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

**Field:** Data Engineering  
**Category:** Analytics & BI  
**Also known as:** Microsoft Power Query, Power Query Editor, Power Query M

## Think of it like

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

## 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

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.

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

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

## Common mistake

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

## Three principles

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

## Related terms

- [Power BI](https://learn.benibix.com/term/data/power-bi)
- [Data Analysis Expressions (DAX)](https://learn.benibix.com/term/data/dax)
- [Extract, Transform, Load (ETL)](https://learn.benibix.com/term/data/etl)
- [Data Source](https://learn.benibix.com/term/data/data-source)
- [Data Integration](https://learn.benibix.com/term/data/data-integration)

## Told apart from

- [Power Query vs DAX](https://learn.benibix.com/compare/power-query-vs-dax): People think Power Query and DAX are two names for one Power BI language. Power Query gets the data and cleans it before it is loaded. DAX works on the data after it is loaded, to add up numbers like total sales or growth on last year. Clean the rows with Power Query, then do the math with DAX.

![A CSV file, a sheet and a database feed into a highlighted box of applied steps: remove columns, filter rows, change type and merge queries, each step saved and written in M. The result is a clean table in Excel or Power BI. A dashed line runs back from the table to the steps, marked refresh: new data, same steps.](https://learn.benibix.com/diagrams/dat-power-query.svg)

---

Source: https://learn.benibix.com/term/data/power-query
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
