I want to subtract sales for each category by quarter with the first quarter being skipped from generating an output and not calculating year-over-year (evaluate 2019 and 2020 separately)
df
Qtr Category Value
202001 1 10
202002 1 40
202003 1 100
202004 1 20
202001 2 80
202002 2 90
202003 2 4
202004 2 7
201901 1 8
201902 1 9
201903 1 20
20194 1 30
Expected Results:
Qtr Name Value
202001 1
202002 1 30
202003 1 60
202004 1 -80
202001 2
202002 2 10
202003 2 -86
202004 2 3
201901 1
201902 1 1
201903 1 11
20194 1 10