6.10 Query Folding
In short: Query folding means Power Query translates your steps into a single query in the source's own language (for example SQL) so the source database does the work, instead of Power BI downloading all rows and processing them locally.
Query folding means Power Query translates your steps into a single query in the source's own language (for example SQL) so the source database does the work, instead of Power BI downloading all rows and processing them locally.
- Folding happens only with sources that understand queries – databases like SQL Server, Oracle, many OData feeds. Flat files such as Excel and CSV do not fold.
- Steps such as filter rows, remove columns, rename, simple joins, group by usually fold.
- Some steps break folding, for example adding an Index column or certain custom M functions. Once folding breaks, later steps also run locally.
- How to check: right-click a step › View Native Query (if enabled, the step folds). Newer versions also show step folding indicators next to each applied step.
Why folding matters
Folding makes refresh much faster, it is how DirectQuery (डेटा स्रोतातच राहतो, प्रत्येक क्लिकला थेट क्वेरी) works, and it is essential for incremental refresh to be effective (without folding, Power Query still has to read all rows from the source). Do filtering and column removal early in your steps, and place steps that break folding as late as possible.
Ravindra Bagale's Tip
The mistake seen most often with folding is assuming everything folds. Steps after a native SQL query, an index column or a custom function often don't. Right-click the steps to check View Native Query, especially before setting up incremental refresh, which depends on folding. Try it once more, then move on.
Ravindra Bagale's Tip – मराठी
Folding मध्ये सगळ्यात जास्त दिसणारी चूक म्हणजे सगळं fold होतं असं गृहीत धरणं. Native SQL query, index column किंवा custom function नंतरच्या steps बऱ्याचदा fold होत नाहीत. Steps वर right-click करून View Native Query तपासा, विशेषतः incremental refresh set करण्याआधी, कारण तो folding वर अवलंबून असतो. पुन्हा एकदा करून बघा, मग पुढे जा.
Ravindra Bagale's Tip – हिंदी
Folding में सबसे ज़्यादा दिखने वाली गलती है यह मान लेना कि सब कुछ fold होता है. Native SQL query, index column या custom function के बाद वाले steps अक्सर fold नहीं होते. Steps पर right-click करके View Native Query check करो, ख़ासकर incremental refresh set करने से पहले, क्योंकि वह folding पर निर्भर है. एक बार फिर करके देखो, फिर आगे बढ़ो.