I’m trying to add two values for the same id.
This can be dynamic but here is a simple example;
{
id=ABC123,
Value=100
},
{
id=ABC123,
Value=200
},
{
id=XYZ123,
Value=100
}
Here I want to get sum of Value for id=ABC123 equals 300.
Basically look through the items where “id” match and there sum “Value”
Oh, I didn’t get that you wanted to calculate a third field. You could simply add the field before pushing the result using result['Quantity'] = result['Sold'] - result['Refund'], in a workflow this would look like so:
I should say that this isn’t really n8n logic, so it might be worth learning a bit of JavaScript in order to be able to write such functions going forward.