Forum Discussion
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.
- Anonymous2 years ago
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 BI (crossjoin.co.uk)
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.
3 Replies
- shafiz_pSuper 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-overflow-and/m-p/1726212
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 herehttps://superuser.com/questions/1193926/stack-overflow-error-importing-data-to-microsoft-power-bi-evaluation-resulted
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. - AnonymousNot 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 BI (crossjoin.co.uk)
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. - BarryFletcherHelper 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