Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a number of "Products" sold by a number of "Customers" what i want to see is if a product is sold by more than one customer.
Data is as follows and I want to create the field "Multiple Sellers" via script
Customer | Product | Sales | Multiple Sellers |
1 | Product A | 5 | Yes |
1 | Product A | 5 | Yes |
1 | Product B | 5 | Yes |
1 | Product B | 5 | Yes |
1 | Product C | 5 | Yes |
1 | Product D | 5 | No |
1 | Product D | 5 | No |
2 | Product A | 5 | Yes |
2 | Product B | 5 | Yes |
2 | Product E | 5 | No |
2 | Product E | 5 | No |
3 | Product B | 5 | Yes |
3 | Product C | 5 | Yes |
4 | Product A | 5 | Yes |
4 | Product A | 5 | Yes |
4 | Product C | 5 | Yes |
Hi @ksharpes
This should work:
[Table]:
LOAD * INLINE [
Customer,Product,Sales,Multiple Sellers
1,Product A,5,Yes
1,Product A,5,Yes
1,Product B,5,Yes
1,Product B,5,Yes
1,Product C,5,Yes
1,Product D,5,No
1,Product D,5,No
2,Product A,5,Yes
2,Product B,5,Yes
2,Product E,5,No
2,Product E,5,No
3,Product B,5,Yes
3,Product C,5,Yes
4,Product A,5,Yes
4,Product A,5,Yes
4,Product C,5,Yes
];
LEFT JOIN
LOAD
IF(Count(DISTINCT Customer) > 1,'Yes','No') AS [Multiple Sellers],
Product
RESIDENT [Table]
GROUP BY Product;
Regards,
Mauritz
Hi @ksharpes
This should work:
[Table]:
LOAD * INLINE [
Customer,Product,Sales,Multiple Sellers
1,Product A,5,Yes
1,Product A,5,Yes
1,Product B,5,Yes
1,Product B,5,Yes
1,Product C,5,Yes
1,Product D,5,No
1,Product D,5,No
2,Product A,5,Yes
2,Product B,5,Yes
2,Product E,5,No
2,Product E,5,No
3,Product B,5,Yes
3,Product C,5,Yes
4,Product A,5,Yes
4,Product A,5,Yes
4,Product C,5,Yes
];
LEFT JOIN
LOAD
IF(Count(DISTINCT Customer) > 1,'Yes','No') AS [Multiple Sellers],
Product
RESIDENT [Table]
GROUP BY Product;
Regards,
Mauritz
Almost had it ><.
Thank you