Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I got this data set
Cust product Amount
A Prod_1 10
A Prod_2 20
B Prod_1 20
C Prod_1 30
C Prod_3 10
I need to write an expression where it sums the amount for only that customer which has only Prod_1.
For Example
It should consider only Cust B because both A and C have others product too .
Thanks,
What is your expected output? You want to see only B cust in your table?
Yes that is right
In expression write
=count({<Cust={"=count(distinct product)=1"}>}Distinct Amount)
Sorry this is right one try
=Sum({<Cust={"=count(distinct product)=1"}>}Distinct Amount)
Or even this is right one
=Sum({<Cust={"=count(distinct product)=1"}>} Amount)
Dear Jean do you have confusion on the output that shown to you let me know about this.
Hi Jean,
may be this
Sum({<Cust=E({<product-={Prod_1}>})>} Amount)
Regards,
Antonio
Another way is you can achieve the same in the script part by find out the frequency of the product count.
Source:
LOAD * INLINE [
Cust, product, Amount
A, Prod_1, 10
A, Prod_2, 20
B, Prod_1, 20
C, Prod_1, 30
C, Prod_3, 10
];
ProdFrq:
Left Join
LOAD
Cust,
Count(product) as CountProd
Resident Source
Group By Cust;
NoConcatenate
LOAD * Resident Source Where CountProd = 1;
DROP Table Source;
It is not working
Can you share some sample for this or can you check my sample on top on that it is working.