Blogs

We provide online programming courses and tutorials suitable for all levels.

Top 3 Query Folding Concepts You Must Know in Power BI

Published on 23 Oct 2025

Top 3 Query Folding Concepts You Must Know in Power BI

When working with Power BI, especially during data transformations in Power Query, you might have come across the term “Query Folding.”

In simple terms, Query Folding refers to the process where Power BI pushes the transformations you apply in Power Query back to the data source instead of performing them locally. This improves performance, efficiency, and ensures data consistency — making it one of the most important optimization features in Power BI.

Query Folding is one of the hidden gem of Power BI performance optimization. Knowing how it works — and how to maintain it — can help you design faster, smarter, and more efficient Power BI reports.

Whether you are connecting to SQL Server or any other relational source, always remember:

“Fold as much as you can, as early as you can.”

 

1. Understanding What Query Folding Is

Query Folding occurs when Power BI translates your data transformation steps (like filters, joins, aggregations) into native queries that the source system (like SQL Server, Oracle, etc.) can execute directly.

For example, if you filter a table in Power Query using “Country = India,” Power BI sends a SQL query like:

SELECT * FROM Sales WHERE Country = 'India'

Instead of loading the entire dataset and filtering locally, this reduces load time and improves performance drastically.

Key Benefit: Data processing happens at the source level, not within Power BI’s memory.

2. Steps That Support Query Folding

Not all transformations support query folding, but several commonly used steps do, such as:

  • Filtering rows
  • Removing or selecting specific columns
  • Merging or appending tables
  • Grouping and summarizing data
  • Sorting or renaming columns

If your source supports folding (like SQL Server, Snowflake, Oracle), try to perform as many steps as possible before breaking the folding chain.

Pro Tip: Always apply heavy transformations (like joins or filters) early in the query to ensure they are folded.

3. When Query Folding Breaks

Certain Power Query transformations break query folding, meaning Power BI can no longer translate the steps back to the source system. After this point, all further operations happen locally in Power BI, reducing performance.

Common reasons query folding breaks:

  • Custom columns using complex M functions
  • Invoking R or Python scripts
  • Merging queries from different sources
  • Using non-foldable transformations (e.g., Index Column, Add Conditional Column in some cases)

Once folding is broken, all subsequent steps are executed in memory which may lead to slower refresh performance.

Power BI

Subscribe to our Newsletter

Get updates for our latest blogs and announcements.