max nested if statements


Is there a limit on nested if statements in TS?  I wrote formula contains more than 200 nested if statements and pasted into TS. It gave me "Time Out" message.  But if I just copy in, say, 3 nested if statements, it works fine.



5replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 200 nested statements is never a good idea... 


    You might want to create it before you put the data into TS. 

    Like 1
  • Ming,

    I'm not sure what the technical limit of nested if statements is ... however, as Marc Price said, it's probably not the best idea to try to have 200 nested if statements. It would be very difficult to maintain a formula like that.

    What are you trying to accomplish? Perhaps there is another way that the problem could be solved.

    Most common approaches:

    1. Add the conditional logic into the ETL process

    2. Add some kind of a mapping table that you join to the model with the specific attributes you are trying to display in ThoughtSpot

    Let us know what you are trying to do and we'll see if we can offer some other suggestions.

  • Thanks for other suggestions but that's not what I am asking.  I just would like to know if there is a max limit.


  • The technical limit varies based on the complexity of the data and the amount of memory available. We have done internal tests that allowed nesting up to about 50 levels.

    HOWEVER, I would not recommend creating nested formulas that deep. You will most likely introduce performance issues, as well as long-term maintainability of the complex formula. Most of our internal team members at ThoughtSpot will limit nesting to around 5-10 and "maybe" as much as 20.

    We are happy to get on an office hours session with you and talk through exactly what you are trying to accomplish and offer potential solutions.

  • Thanks Marc Price and Dave Cohen  for helping answer this one. 


    mxl , if you're looking to schedule time with a ThoughtSpot pro, please use the following link (also available under Helpful Links under Meet a Pro). 

Like Follow
  • Status Answered
  • 4 mths agoLast active
  • 5Replies
  • 43Views
  • 4 Following