Hi - im having trouble with the rollingsum function - I would like to exclude the current record and only look at the previous records.
The syntax I'm using is rollingsum(field,-1,0) - which excludes all next records but includes all previous and the current - I would like to exclude the current
Solved! Go to Solution.
Hi,
If I understood correctly, I tried as below and let me know if that matches your requirement.
attached is the input file I used.
@Sridar Krishnamoorthy? your solution will only remove the first item from each group. As I understood the question @Andrew Johnson? is looking to exclude each record from the calculation of it's rolling sum. The easiest way to do this would be to subtract the record from the ROLLINGSUM function, e.g.:
ROLLINGSUM(field,-1,0)-field
Hope this helps!
@Alon Bartur? Nope, If you see the previous working example attachment,
Moreover ROLLINGSUM(field,-1,0)-field will result first line value = 0 for new group.
Got it, I still think that the first line value should be 0 if you're looking to exclude the current value but if that's not the case then your solution would work
Hi Both - the example Sridar shared seems to work - thanks!
One more question - it appears you created the columns without a window - when I try to create the columns with a "new formula" it requires I use a window function - how do you do that?
Pls find attached recipe and let me know if it doesn't work!