Query Folding in Power BI Explained: Why It Can Make Your Reports Much Faster
Join My PowerBI Live Classes — https://topmate.io/anurodh_kumar10/2159693?utm_source=public_profile&utm_campaign=anurodh_kumar10
If you’ve ever wondered why one Power BI report refreshes in seconds while another takes several minutes, Query Folding is often part of the answer.
Many Power BI beginners spend time optimizing DAX measures or reducing visual complexity but overlook one of the biggest performance boosters available in Power Query.
In this article, you’ll learn:
- What Query Folding is
- Why it’s important
- How it works
- How to check if it’s happening
- Best practices to keep it working
Let’s dive in.
What Is Query Folding?
Query Folding is the process where Power Query translates your transformation steps into a query that runs on the data source instead of inside Power BI.
Instead of downloading all the data and transforming it locally, Power BI asks the source system to perform the work first.
Only the final result is returned to Power BI.
In simple terms:
Let the database do the heavy lifting.
A Simple Example
Imagine your SQL Server database contains 10 million sales records.
You only need sales from 2025.
❌ Without Query Folding
Power BI:
- Downloads all 10 million rows.
- Filters the data locally.
- Loads the remaining records.
Result:
- More data transferred
- Longer refresh times
- Higher memory usage
✅ With Query Folding
Power BI sends a request like:
SELECT *
FROM Sales
WHERE Year = 2025;The database performs the filtering.
Power BI receives only the required rows.
Result:
- Less data transferred
- Faster refresh
- Better overall performance
Why Is Query Folding Important?
Modern databases such as SQL Server, Azure SQL Database, Snowflake, and Synapse are designed to process massive amounts of data efficiently.
When Query Folding is enabled, these systems handle the expensive operations, allowing Power BI to focus on visualization and analysis.
Benefits include:
- ⚡ Faster refresh times
- 📉 Lower memory consumption
- 🌐 Reduced network traffic
- 🗄️ Better use of database optimization
- 📊 Improved scalability for large datasets
How Query Folding Works
The process is straightforward:
Connect to Data Source
↓
Apply Transformations
↓
Power Query Translates Steps
↓
Database Executes Query
↓
Power BI Receives Final ResultPower Query continuously evaluates each transformation to determine whether it can be translated into a native query that the data source understands.
If it can, the step is “folded.”
Common Transformations That Usually Fold
Many basic transformations support Query Folding, especially with relational databases.
These include:
- Filter Rows
- Remove Columns
- Rename Columns
- Change Data Type
- Sort Rows
- Keep Rows
Depending on the data source, these may also fold:
- Merge Queries
- Group By
Note: Query Folding support depends on the connector and the capabilities of the underlying data source.
Transformations That May Break Query Folding
Not every transformation can be translated into a native database query.
Common examples include:
- Adding an Index Column
- Running Python scripts
- Running R scripts
- Invoking custom functions
- Using
Table.Buffer() - Certain complex custom M expressions
Once a step breaks folding, subsequent transformations are usually processed locally by Power BI.
How to Check Whether Query Folding Is Working
Power BI makes this easy.
In Power Query Editor:
- Open Applied Steps.
- Right-click the latest transformation.
- Select View Native Query.
If the option is available
✅ Query Folding is still active.
If the option is disabled
❌ One of the earlier steps has prevented Query Folding.
Checking this periodically while building queries is a good habit, especially when working with large datasets.
Best Practices for Maintaining Query Folding
To get the best performance, follow these recommendations:
1. Filter Early
Reduce the number of rows as soon as possible.
Smaller datasets mean less processing later.
2. Remove Unnecessary Columns
Only keep the columns you need.
This reduces memory usage and network traffic.
3. Keep Transformations Simple
Basic filtering, sorting, and selecting columns are more likely to fold than complex custom logic.
4. Delay Complex Operations
If you need custom M code or advanced transformations, perform them toward the end of the query whenever possible.
5. Check Query Folding Regularly
Use View Native Query after adding major transformation steps.
This helps identify exactly where folding stops.
Does Every Data Source Support Query Folding?
No.
Query Folding depends on the connector and the data source.
Generally, relational databases provide the best support.
Examples include:
- SQL Server
- Azure SQL Database
- Azure Synapse Analytics
- PostgreSQL
- Oracle
- Snowflake
For flat files such as Excel or CSV, there is no query engine behind the source, so Query Folding does not apply.
Common Beginner Misconception
Many people assume that every transformation in Power Query automatically improves performance.
That’s not always true.
A transformation that breaks Query Folding can force Power BI to process large amounts of data locally, leading to slower refreshes.
The goal isn’t simply to apply transformations — it’s to apply them in a way that allows the source system to do as much work as possible.
Quick Memory Trick
Think of Query Folding like ordering food at a restaurant.
❌ Without Query Folding
You bring home every ingredient and cook the meal yourself.
✅ With Query Folding
The restaurant prepares the meal, and you only receive the finished dish.
Similarly, let the database prepare the data before it reaches Power BI.
Query Folding is one of the most valuable performance features in Power BI, yet it’s often overlooked by beginners.
By allowing the data source to perform transformations, you reduce data movement, improve refresh times, and build more scalable solutions.
Whenever you’re working in Power Query, remember this simple principle:
Move the work closer to the data.
The more processing your database performs, the less work Power BI has to do — and the faster your reports are likely to be.
Key Takeaways
- Query Folding pushes transformations to the data source.
- It reduces data transfer and speeds up refreshes.
- Basic transformations usually support folding.
- Some advanced operations can break folding.
- Use View Native Query to verify if folding is still active.
- For supported data sources, keeping Query Folding active as long as possible is a Power BI performance best practice.
If you found this article helpful, follow me for more beginner-friendly content on Power BI, Microsoft Fabric, DAX, Power Query, Data Modeling, and Performance Optimization.
Join My PowerBI Live Classes — https://topmate.io/anurodh_kumar10/2159693?utm_source=public_profile&utm_campaign=anurodh_kumar10

Comments
Post a Comment