I have scenario where I have XML output ready to upsert into my SFDC object. But data at this stage is coming with multiple records for same external Id but with different sales numbers (based on specific category), since the source of data is our ERP system.
Before upsert I wanted to merge multiple records into one record where external id is same, while merging i wanted to apply various operations on each field. e.g. 2-3 fields will perform sum, 2-3 fields concatenate string
Below is the representation of my example: