I am trying to do a cumulative product between Column1 and the previous row of Column2 in Spotfire. As in the Table below, I need Column2 to be the product of DataColumn1 and the previous value of CalculatedColumn2. Column2 is the calculated column I am trying to create.
I am stuck because there is obviously a cyclical dependency if using a Spotfire calculated column. For this reason I have no code or error to share, I know a simple calculated column will not work. I think I need to use custom expression functions or some sort of R code in order to do it but have never worked in R and need help!
This question and answer linked here are exactly what I am trying to do. The answer to this question has a code that worked for this person, but how do I use that code in a Spotfire calculated column and enter my corresponding columns?
DataColumnA | CalculatedColumnB |
---|---|
6 | 6 |
8 | 48 |
9 | 432 |
2 | 864 |
4 | 3456 |
6 | 20736 |
Any help is very appreciated! Thank you!