0

Good afternoon -

I have a table in Teradata that stores a rolling cumulative sum that resets every month. I would like to be able to calculate the incremental gain between each day of the month. Is this something that I can accomplish with olap functions or should it be handled in a recursive cte? Would love assistance thinking through this. Thanks!

example source

date month cum_value
2022-07-02 July 2022 25
2022-07-01 July 2022 5
2022-06-30 June 2022 100
2022-06-29 June 2022 70
2022-06-28 June 2022 65
2022-06-27 June 2022 50

example result

date month cum_value incremental_value
2022-07-02 July 2022 25 20
2022-07-01 July 2022 5 5
2022-06-30 June 2022 100 30
2022-06-29 June 2022 70 5
2022-06-28 June 2022 65 15
2022-06-27 June 2022 50 ..
ChrisCamp
  • 672
  • 1
  • 5
  • 20

0 Answers0