I have the following query

SELECT DISTINCT
date_part('month', "Product Monitoring"."Date"),
SUM("Product Monitoring"."Realisasi SO"),
SUM("Product Monitoring"."Target"),
FROM "public"."Product Monitoring"
GROUP BY
date_part('month', "Product Monitoring"."Date")

I need to calculate the variance between Realisasi SO (Actual) and Target. this difference is then add to the target of the following month.

The idea behind this is simple, what ever target was not achieved get carried forward and accumulated to the following month, How can I do this?

Thanks in advance.