Query folding in Power Query, explained

What query folding is in Power Query, how to see whether a step folds, which steps break it, and why incremental refresh depends on it.

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?

Stepsfilter to 2026, keep four columns, group by month
Foldsone SQL query; the source returns 12 rows
Does not foldthe whole table comes back; Power Query filters it
The same steps, two outcomes

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
    Columns

and 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?

StepUsually folds
Filter rows, remove columns, renameyes
Group by, sort, merge with another table on the same sourceyes
Change type to a type the source hasyes
Add index columnno
Table.Buffer, or a custom function per rowno
Merge with a table from another source, like Excelno
Typical steps against a SQL source

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 = true or 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?

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.

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.