Recursion Examples in Quantrix Formulas

2.62K viewsTips and Techniques

Greetings Forum Community,

We have had a couple of questions recently regarding Formula recursion statements [THIS], [PREV] etc. The user wanted to know if the Recursion statements could be used to sum the previous 3 months worth of data.

So instead of writing a formula that said:

Month4:total = Month1:data + month2:data + month3:data.

They wanted to know if Recursion could be used instead. It can! With recursion, you can write one formula to calculate the previous 3 months like the following:

Total = sum(Month[PREV-2]:Data .. Month[PREV]:Data)

You can use the ‘-‘ and ‘+’ with your recursion statements to make your formulas more powerful and dynamic. Please see the <a href=””><strong> Cumulative Total Template Model</strong></a> in our template section for more examples.