Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
BarryFletcher
Helper III
Helper III

Expression.Error: Evaluation resulted in a stack overflow and cannot continue.

Hi all,

 

I have an excel spreadsheet as a source for my Power BI dashboard that has been working perfectly for months. Today, for some reason I am getting "Expression.Error: Evaluation resulted in a stack overflow and cannot continue"

 

I haven't changed the source or query etc

 

Any help greatfully appreciated.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @BarryFletcher ,

The reason for this problem is generally because, you are using recursion in your query (i.e. a function that calls itself appears).
When you had a small amount of data before, you were able to use recursion to calculate Power Query, so you were able to run it before. However, as the amount of data you are updating increases, the number of queries Power Query needs to process will increase exponentially until it reaches its processing limit, and then the error will occur.

The general solution is to Group by the data first, and then recurse on the data in each Group, so that the amount of data that needs to be processed for each recursion will be much smaller. Or you can go back to the data source and implement recursion in the data source, because the processing power of the data source will be much stronger than Power Query.

Also I found this blog that might be helpful:
Understanding the "Evaluation resulted in a stack overflow" error in Power Query in Excel and Power ...

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
BarryFletcher
Helper III
Helper III

Hi all,

 

This is my file - I don't see any issues as outlined in the replies above - would appraciate if someone could take a look and help me out please?

 

https://drive.google.com/file/d/1LMuJGNIVpaD1e07MHXe77MpdAMWlETit/view?usp=drive_link

 

Much appreciated,

Barry

Anonymous
Not applicable

Hi @BarryFletcher ,

The reason for this problem is generally because, you are using recursion in your query (i.e. a function that calls itself appears).
When you had a small amount of data before, you were able to use recursion to calculate Power Query, so you were able to run it before. However, as the amount of data you are updating increases, the number of queries Power Query needs to process will increase exponentially until it reaches its processing limit, and then the error will occur.

The general solution is to Group by the data first, and then recurse on the data in each Group, so that the amount of data that needs to be processed for each recursion will be much smaller. Or you can go back to the data source and implement recursion in the data source, because the processing power of the data source will be much stronger than Power Query.

Also I found this blog that might be helpful:
Understanding the "Evaluation resulted in a stack overflow" error in Power Query in Excel and Power ...

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

shafiz_p
Super User
Super User

Hi, @BarryFletcher  If you have appened queries, you can follow this earlier post

https://community.fabric.microsoft.com/t5/Desktop/Expression-Error-Evaluation-resulted-in-a-stack-ov... 

If your problem still exist, then enable trace in diagnostic from the option in power bi and refresh report again to capture log. Follow this steps, mentioned here

 

https://superuser.com/questions/1193926/stack-overflow-error-importing-data-to-microsoft-power-bi-ev... 

If you have used recursive function in your queries, then try to avoid it. Also, you can check each step where this error appeared.

Hope this helps!!

If this solved your problem, please mark it as a solution.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.