Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi to all, I have broblem that I hope to solve it with your help....
I would like to count the customer who bought specific items and not boutght specific items.
I have table like this.
customer_id, item_id
customer1,item1
customer1,item2
customer2,item1
customer2,item1
customer3,item1
customer3,item2
customer3,item3
customer4,item2
customer4,item3
customer5,item3
customer5,item3
customer6,item1
customer6,item3
And I would like to count the customer who bought item1 and not boutht item2.
The result I want is 2(customer2 and customer6).
I try the following expression, but it doesn't work.
Count({$<item_id={'item1'}> - <item_id={'item2'}>} Distinct customer_id)
Thanks for your help.
Toan
May be this:
Count({$<customer_id = p({<item_id = {'item1'}>}) * e({<item_id = {'item2'}>})>} DISTINCT customer_id)
May be this:
Count({$<customer_id = p({<item_id = {'item1'}>}) * e({<item_id = {'item2'}>})>} DISTINCT customer_id)
=concat({$<customer_id = p({<item_id = {'item1'}>})
- p({<item_id = {'item2'}>})
>}
DISTINCT customer_id,' ')
I try this and it works.
Thank you for your help!
I try this and it works.
Thank you for your help!
If your question is now answered, please flag the Correct Answer (via the big "Correct Answer" button near every post) and Helpful Answers (found under the Actions menu under every post).
If not, please make clear what part of this topic you still need help with .
Thank you for your comment.
But I can't find "correct Answer" button near post.
Instead, I find 'Helpful Answers' button, so I flag this.