Power BI Query Folding

Introduction

Query Folding is a powerful feature in Power BI that can significantly enhance your data analysis capabilities. It allows Power Query to push some of the data transformations back to the data source, which can improve the performance of data refresh and incremental refresh processes.

Here are some details about Query Folding in Power BI, along with some images.

Native Query

What is Query Folding?

Query Folding is a process in Power Query where some of the data transformations are pushed back to the data source instead of being performed by Power Query itself. This can improve the performance of data refresh and incremental refresh processes.

How does Query Folding work?

When a query is created in Power Query, it is translated into a series of SQL statements that are sent to the data source. If the data source supports Query Folding, it will perform some of the transformations and return only the necessary data to Power Query. If the data source does not support Query Folding, Power Query will perform all of the transformations itself.

Benefits of Query Folding

Query Folding can improve the performance of data refresh and incremental refresh processes, as it reduces the amount of data that needs to be transferred between Power Query and the data source. It can also reduce the load on the Power BI service and the data source, as some of the transformations are performed by the data source instead of Power Query.

Limitations of Query Folding

Query Folding has some limitations, such as:

  • Not all data sources support Query Folding.
  • All the steps in the query must allow Query Folding. If even a single action cannot be folded, Query Folding will stop for the entire query.
  • The query must not start with custom SQL code, as no steps in the query will be folded.

How to check if Query Folding is working?

Power Query provides Query Folding indicators that show whether Query Folding is being used for a particular step in the query. To check if Query Folding is working, you can apply a filter to any of your columns and see if the Query Folding indicator in the Applied Steps pane turns green.

Examples of Query Folding

Some examples of Query Folding include filtering, sorting, and selecting columns. When these operations are performed in Power Query, they are translated into SQL statements that are sent to the data source. If the data source supports Query Folding, it will perform these operations and return only the necessary data to Power Query.

Filtering

Sorting

Conclusion

Query folding is a powerful technique in Power BI for optimizing query performance, reducing resource consumption, and ensuring data freshness. By understanding how to leverage it effectively with practical examples, you can create faster, more efficient reports and gain deeper insights from your data.

Incorporate query folding into your Power BI workflows, especially when dealing with large datasets or complex transformations, and watch your reports become more responsive and reliable.


Similar Articles