Condition to insert calculation is not working.