Can you please provide more details on this? What code you have written and on what condition you are adding two fields?
If possible share your form and detailed scenario.
As per the above detail, you need to check the value of field on which addition is applied.
if(sameItem is true or whatever your condition is){
then add your other field here
}
Thank You.