Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Here is my data set.
Customer | Product | Amount |
---|---|---|
CustA | Prod_1 | 100 |
CustB | Prod_2 | 200 |
CustC | Prod_1 | 300 |
CustC | Prod_3 | 100 |
CustD | Prod_1 | 20 |
CustE | Prod_1 | 200 |
CustF | Prod_1 | 100 |
CustF | Prod_4 | 100 |
CustG | Prod_3 | 400 |
I need to write an expression something like this
sum ({<Customer={'CustA', 'CustB', 'CustF', 'CustC', 'CustD'}> - <Customer=p({<Product={'Prod2', 'Prod3'}>})>}Amount)
it should return amount of CustA and CustD becasue only these two customers in the first list(in red) have not bought Prod2 and Prod3.
It should not return amount of CustE even though it also have bought Prod2 and Prod3 because it is not in the first list(in red)
The intention is to choose only those customers who are in first list (in red) and those who have not bought products mentioned in the second list (in green).
Why not include CustF? He hasn't bouth Prod2 or Prod3... may be this
Sum({<Customer={'CustA', 'CustB', 'CustF', 'CustC', 'CustD'}-p({<Product={'Prod_2', 'Prod_3'}>})>}Amount)
Why not include CustF? He hasn't bouth Prod2 or Prod3... may be this
Sum({<Customer={'CustA', 'CustB', 'CustF', 'CustC', 'CustD'}-p({<Product={'Prod_2', 'Prod_3'}>})>}Amount)
You are right.
In fact even my expression worked but yours is more elegant.