{"id":4251,"date":"2023-02-21T14:13:47","date_gmt":"2023-02-21T14:13:47","guid":{"rendered":"https:\/\/www.biconnector.com\/blog\/?p=4251"},"modified":"2023-05-18T05:16:29","modified_gmt":"2023-05-18T05:16:29","slug":"query-folding-power-bi-everything-you-need-to-know","status":"publish","type":"post","link":"https:\/\/dev.biconnector.com\/blog\/query-folding-power-bi-everything-you-need-to-know\/","title":{"rendered":"Query Folding in Power BI: Everything you need to know"},"content":{"rendered":"\n
Query folding is a powerful feature in Power BI that can significantly enhance your data analysis capabilities. To maximize its benefits, it’s essential to have a clear understanding of what it is and how it works. This article will provide a comprehensive guide to query folding in Power BI, covering everything you need to know.<\/p>\n\n\n\n
Query Folding is the capability of a Power Query to create a single statement that can transform and execute tasks (such as filtering a thousand rows of data) on the data source side. Through Query Folding, Power Query can deal with a vast volume of data efficiently.<\/p>\n\n\n\n
You can think of Query folding as writing down a set of instructions in SQL code and passing it over to the database for enforcement. In essence, the data source does the heavy lifting and, in turn, reduces the amount of data that has to be processed and transferred within Power BI. <\/p>\n\n\n\n
Power Query will automatically execute query folding under the following conditions:<\/p>\n\n\n\n
1.\tThe data source is a database that can accept a query request. <\/p>\n\n\n\n
2.\tAll the steps in the configuration must allow query folding. If you perform even a single action that cannot be folded, query folding will stop for the entire query.<\/p>\n\n\n\n
3. The Query must not start with your own SQL code. If you start your query with your own SQL code, no steps in the query will be folded.<\/p>\n\n\n\n
To find if a data source supports Query Folding in Power BI, follow the steps given below:<\/p>\n\n\n\n
1. Right-click your sheet on the Report View in the field pane and select Edit Query<\/strong>. You will be redirected to the Power Query Editor<\/strong>.<\/p>\n\n\n\n