Power BI: Query Folding

The query folding can be used to increase the performance of your Power BI reports. This feature called View Native Query is available in the applied steps window in Power Query Editor.

The query folding is essentially a process by which the transformations and edits that you make in Power Query Editor are sent back to the data source server and are executed there in its native language or simple Select SQL statements.

This is particularly important while you are dealing with a large amount of data. For example, if you have a sales table with 100 million rows in SQL server, you may need to filter and import only the last year of data to Power BI.

When to use query folding

Query folding is enabled by default. One can use query folding If one can translate a transformation into a Select SQL statement, which includes operators and clauses such as GROUP BY, SORT BY, WHERE, UNION ALL, and JOIN.

Native queries are not possible for the following transformations:

  • Using an unsupported transform type such as Merging and appending columns of different tables with two different sources
  • Connecting to an unsupported data source such as a flat file
  • Changing the data type of a column
  • Adding custom columns with complex M functions
  • Adding an index column