Input:
item loc qty year month
A IND 10 2019 13
A IND 20 2020 1
A IND 10 2020 2
A IND 40 2020 3
A IND 50 2020 5
A IND 10 2020 6
OUTPUT:
item loc sum(qty) year month
A IND 0 2019 13
A IND 10 2020 1
A IND 30 2020 2
A IND 40 2020 3
A IND 50 2020 5
A IND 90 2020 6
description:
how will i get my output is as follows:
if i am calculationg for year 2020 and month 3 then i need to consider the sum(qty) between (month-3) and (month-1) i.e. in this case it will be from year 2019 month 12 to year 2020 and month 2
so for year 2020 and month 3 the ouput will be sum(qty)=10+20+10=40
now for year 2020 and month 6
sum(qty) will be between year 2020 and month -3=3 and year 2020 and month-1=5
so sum(qty)=0(0 for month 4 which is not in the table)+40+50=90