The Query Folding mechanism in Power BI
In Power Query Online we can notice if a step is folded through step folding indicator, as it shows if steps have been evaluated in the data source or in the Power Query engine.
We can also display the #Query_Plan to show how queries are run and steps folding plan.
When a query gets executed, Power Query tries to push as much work as possible to the data source, by asking for the data from the data source in the first step. The data fetched from the data source is defined by the query folding mechanism, which can be classified into 3 levels of query folding:
✔No query folding: queries will download all records from the data source and do all transformations in Power Query
✔ Partial query folding: queries will download some data filtered from the data source then do some transformations steps in Power Query
✔Full query folding: all requested transformations are fully folded to the data source, so the Power Query will receive required data processed.
Query folding will minimize transformations performed in the power query engine, decrease data in transit and consequently reduces the refresh time result.
read the following article to understand queries evaluation for the 3 types of query folding