Short answer: query folding means Power Query turns your steps into one query in the source's own language, usually SQL, so the source does the filtering and grouping and sends back only the result. When a step cannot be translated, folding stops there: every step after it runs in Power Query, on all the rows the source sent. Keep the steps that fold first, and check with View Native Query or the step folding indicators.
A filter to last month on a ten-million-row table is instant when it folds and pulls all ten million rows when it does not. The steps look the same in the editor; only the query sent differs.
What does a folded query send?
These steps fold against SQL Server:
let
Source = Sql.Database("sql01", "Sales"),
Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data],
Recent = Table.SelectRows(Orders, each [OrderDate] >= #date(2026, 1, 1)),
Columns = Table.SelectColumns(Recent, {"OrderDate", "CustomerID", "Amount"})
in
Columnsand the source receives one query:
SELECT [OrderDate], [CustomerID], [Amount]
FROM [dbo].[Orders]
WHERE [OrderDate] >= '2026-01-01'Which steps keep folding, and which stop it?
| Step | Usually folds |
|---|---|
| Filter rows, remove columns, rename | yes |
| Group by, sort, merge with another table on the same source | yes |
| Change type to a type the source has | yes |
| Add index column | no |
| Table.Buffer, or a custom function per row | no |
| Merge with a table from another source, like Excel | no |
Right-click a step: if View Native Query is available, everything up to that step folds. In Power Query Online and Dataflow Gen2, the step folding indicators mark each step as folding, not folding or unknown.
Why does incremental refresh need it?
Incremental refresh filters each partition by RangeStart and RangeEnd. If that filter folds, each refresh asks the source for a few days of rows. If it does not, Power BI fetches the whole table for every partition and throws most of it away, which is slower than no incremental refresh at all.
What goes wrong?
- A non-folding step early. One index column at step two means everything after runs locally. Move such steps to the end.
- Native SQL typed by hand. A custom SQL statement can stop later steps from folding. Use it with
EnableFolding = trueor put the logic in a view. - Assuming files fold. CSV and Excel sources have nothing to fold into; filter them as early as possible anyway, but expect full reads.
Where can you check this?
- Microsoft Learn: Overview of query evaluation and query folding in Power Query
- Microsoft Learn: Step folding indicators
- Microsoft Learn: Query folding guidance in Power BI Desktop
Where do you start?
Incremental refresh in Power BI is where folding matters most, and Dataflow Gen2 shows the step folding indicators at work in Fabric.