Sorry for my poor math skills. Please down vote after stating the reason.
I have 4 values A, B, C and D. Following is the calculation.
$(A + B + C) - D = Total.$
Later any of $A,B,C$ or $D$ will replace with new value.
Eg: $A = 100$
$B = 200$
$C = 300$
$D = 200$
$(100 + 200 + 300) - 200 = 400$
New value of $A = 600$
What I have is Total 400 and Old A value 100 and new A value 600.
$(400 - 100) + 600 = 900$ //Output
Following is my current formula.
var newVal = 0;
if(not D){
newVal = (net - prevVal) + newVal;
}else{
newVal = (net + prevVal) - newVal;
}
Is there any other way / formula to find the impact on total when replace an old value ?