Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculating / expression

I have data file looking like this:

udklip.jpg

There are 4 different SalesID (250 - 450 - 100 - 800). Now I like to calculate how many pieces of product AA10 has SalesID 250 sold but deducted all the products which has been resold.

EG.:

'SalesID 250' has sold 10 items of AA10 to 'BuyerID 450' - but 'BuyerID 450' has resold  2 items of AA10 to 'BuyerID 900':

The calculate figure should be 8 (10 - 2)

and

'SalesID 250' has sold 5 items of AA10 to 'BuyerID 300' - and 'BuyerID 300' hasn't resold any items of AA10

The calculate figure should be 5 (5 - 0)


Any suggestions how to calculate this ?


BR,

Kenneth

4 Replies
marcus_malinow
Partner - Specialist III
Partner - Specialist III

sum({$<SalesID={'250'}>} Quantity) - sum({$<SalesID-={'250'}>} Quantity)

Not applicable
Author

Thanks. But I need an expression which can handle every SalesID and not just only SalesID 250. In other words a variable - not just a fixed value.

marcus_malinow
Partner - Specialist III
Partner - Specialist III

ok, well assuming you have a variable (vSalesID)

sum({$<SalesID={'$(vSalesID)'}>} Quantity) - sum({$<SalesID-={'$(vSalesID)'}>} Quantity)

martinpohl
Partner - Master
Partner - Master

You have to do it in the script:

Then the result is:

Regards