Calculating Periodic values from YTD

82 Views Asked by At

I have a dataset which has 12 columns which includes an amount column which is arriving as YTD. I need to convert the Ytd into a periodic and populate in a new column. We are receiving 300-400k records per month with the month column changing and the respective amount column.

So i need to convert this amount column into periodic values. For ex for jan the periodic should be same as YTD. For feb it should be the difference of Feb and Jan. For mar it should be the difference of Mar and Feb and so on.. We have to consider all the columns while calculating the difference between the months.. (Assuming same amount of data will be populated every month).

I tried lag but still I can see some error.

Ps: calculating YTD is not required but the periodic

0

There are 0 best solutions below