Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi everyone, Can someone explain query folding in Power BI? How does it work ?
Thanks in advance
Solved! Go to Solution.
The goal of query folding is to offload or push as much of the evaluation of a query to a data source that can compute the transformations of your query.
The query folding mechanism accomplishes this goal by translating your M script to a language that can be interpreted and executed by your data source. It then pushes the evaluation to your data source and sends the result of that evaluation to Power Query.
This operation often provides a faster query execution than extracting all the required data from your data source and running all transforms required in the Power Query engine.
https://learn.microsoft.com/en-us/power-query/query-folding-basics
Query folding is a process in Power BI where the steps of data transformation applied in the Power Query Editor are translated into native query language, which is then executed directly in the data source. This means that instead of pulling all the data into Power BI and then applying transformations, Power BI pushes the transformations back to the data source, allowing the source system to handle the heavy lifting. This can significantly improve performance and efficiency, especially when dealing with large datasets
When you apply transformations in Power Query, such as filtering rows, adding columns, or merging tables, Power BI tries to translate these steps into a single query that the data source can understand and execute. This process is known as query folding. If all the steps can be folded, the data source returns only the transformed data to Power BI, reducing the amount of data that needs to be transferred and processed.
Imagine you have a SQL Server database with a table containing sales data. You want to filter the data to include only sales from the last year and then group the data by product category. In Power Query, you would apply a filter step and a group by step. If query folding is possible, Power BI will generate a SQL query that includes both the filter and group by operations, and the SQL Server will execute this query and return only the aggregated data for the last year.
You can check if query folding is occurring by right-clicking on a step in the Power Query Editor and selecting "View Native Query." If the option is available, it means that the step is being folded into the native query. If it's grayed out, it means that query folding is not happening for that step.
Not all data sources and transformations support query folding. For example, some custom transformations or data sources without native query capabilities may prevent query folding. In such cases, Power BI will handle the transformations locally, which may impact performance.
Query folding is a process in Power BI where the steps of data transformation applied in the Power Query Editor are translated into native query language, which is then executed directly in the data source. This means that instead of pulling all the data into Power BI and then applying transformations, Power BI pushes the transformations back to the data source, allowing the source system to handle the heavy lifting. This can significantly improve performance and efficiency, especially when dealing with large datasets
When you apply transformations in Power Query, such as filtering rows, adding columns, or merging tables, Power BI tries to translate these steps into a single query that the data source can understand and execute. This process is known as query folding. If all the steps can be folded, the data source returns only the transformed data to Power BI, reducing the amount of data that needs to be transferred and processed.
Imagine you have a SQL Server database with a table containing sales data. You want to filter the data to include only sales from the last year and then group the data by product category. In Power Query, you would apply a filter step and a group by step. If query folding is possible, Power BI will generate a SQL query that includes both the filter and group by operations, and the SQL Server will execute this query and return only the aggregated data for the last year.
You can check if query folding is occurring by right-clicking on a step in the Power Query Editor and selecting "View Native Query." If the option is available, it means that the step is being folded into the native query. If it's grayed out, it means that query folding is not happening for that step.
Not all data sources and transformations support query folding. For example, some custom transformations or data sources without native query capabilities may prevent query folding. In such cases, Power BI will handle the transformations locally, which may impact performance.
The goal of query folding is to offload or push as much of the evaluation of a query to a data source that can compute the transformations of your query.
The query folding mechanism accomplishes this goal by translating your M script to a language that can be interpreted and executed by your data source. It then pushes the evaluation to your data source and sends the result of that evaluation to Power Query.
This operation often provides a faster query execution than extracting all the required data from your data source and running all transforms required in the Power Query engine.
https://learn.microsoft.com/en-us/power-query/query-folding-basics
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
68 | |
57 | |
55 | |
36 | |
34 |
User | Count |
---|---|
81 | |
75 | |
49 | |
45 | |
43 |