4 Replies Latest reply: Oct 30, 2015 6:44 AM by Martin Pohl

# Calculating / expression

I have data file looking like this:

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

• ###### Re: Calculating / expression

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

• ###### Re: Calculating / expression

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.

• ###### Re: Calculating / expression

ok, well assuming you have a variable (vSalesID)

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

• ###### Re: Calculating / expression

You have to do it in the script:

Then the result is:

Regards