Aggregate remaining work to parent issue - decreasing!

Oct 12, 2015 at 7:37 AM
Hi,

I followed the sample for a simple rollup.

_self.Parent["Custom.RemainingWork"] = (double)self.Parent["Custom.RemainingWork"] + (double)self["Microsoft.VSTS.Scheduling.RemainingWork"];

It works fine.

But the Problem is that the parent value will be increased with every change.
If the child has a value of 5, the parent value will be increased by 5.
When I change the child value from 5 to 2, the parent value will be increased be 2.
But it should be decreased with 3.

So I want to aggregate the difference from the new value to the old value and not the raw new value only.
I need to decrease the parent value also.

Could you help me please?
What can I do to achieve this goal?

thanks in advance
Martin