Forum Discussion

BarryFletcher's avatar
BarryFletcher
Helper III
2 years ago
Solved

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.

  • Anonymous's avatar
    Anonymous
    2 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