if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 1, 0,
if(Previous(Install_Flag) = 1 and Previous(Removal_Flag) = 0, rangesum(peek('Age'),1),
if(Previous(Install_Flag) = 0 and Previous(Removal_Flag) = 1, 0,
if(Previous(Peek('Age2')) = 0, 0, Rangesum(Peek('Age2'),1)))))) as Age2
All this is working fine.
Only problem is please see the below image
Here if you see in KEY_EMS there we have some nulls and if you see in the Age2 column there the subtraction is not happening correct(between technical_start_Date - Calendar_Month_Code) and the months are showing in-correct.
Can you please check and let me know what i need to do.