1 2 Previous Next 16 Replies Latest reply on Aug 1, 2019 4:24 AM by Jim Dehner

# Count Customers that only purchased product A not Product B and count customers that purchased A and B.

So I am trying to count three different metrics.

Count customers that only purchased 'Product 1'

-This will exclude customers that did buy 'Product 1' but also purchase other products. So if they purchased 'Product 1' but also in a different order they purchased 'Product 2' they will not be counted.

Count customers that only purchased 'Product 2'

-This will exclude customers that did buy 'Product 2' but also purchase other products.  So if they purchased 'Product 2' but also in a different order they purchased 'Product 1' they will not be counted.

Count customers that purchased 'Product 1' and 'Product 2'

-This will only include customer that bought both 'Product 1' and 'Product 2' no other products

I have included a very basic example workbook, but can work out the general idea. This seems really easy but for some reason I can put it together in my head.

• ###### 1. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

From your data , you have 3, 19 and 3 Distinct customers who purchased Product 1, Product 2 and Both. See attached.

Thanks

Deepak

• ###### 2. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Ok, so this somewhat works but I should have mentioned that I want to create a histogram with this data and using these filter will not work for that.

• ###### 3. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

So what do you need actually? Pl specify in detail. That helps everyone.

Thanks

Deepak

• ###### 4. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Ok so I want all three values on the same scale.

@

Only on the same scale and same sheet, this image is three sheets on a dashboard.

• ###### 5. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Hi LL,

Please check the screenshot and attached.

Thanks

Deepak

1 of 1 people found this helpful
• ###### 6. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Thanks this works great but the both would not work if you had more then 2 products.

• ###### 7. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

This is what As per your data and Requirement. Rest you can modify as per your data.  If it was Helpful, you can mark it Helpful and CORRECT.

Thnaks

Deepak

• ###### 8. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Hi Deepak,

Your solution is useful. But when I try to alter the data a bit, for example, customers buying product 1,  the original are customer ID 2, and 11 and 13.

When I try to add purchase record under Customer ID 2, this time still purchase Product Code 1, but then the count of Customer ID 2 disappear from the worksheet.

Now the result shown has become 3, 2, and 19.

I'm curious is that Customer buying 2 Products seems to be allow to buy multiple times of same or different product, but Customer buying only 1 product can only buy once.

I cannot figure out how to solve this problem. Will be great if you can share some insight.

Regards

Cat

• ###### 9. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Good morning

this is a brute force way to get a result

see the  attached approach using sets (note if you are on 2018.3 or above you can use set actions to change the sets)

create 2 sets

then this just puts a value against customers / products combinations in the various sets and then sums them by customer

this puts a label on the customer

it returns this with your dummy data

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

1 of 1 people found this helpful
• ###### 10. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Yay for sets!!!

• ###### 11. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Michael - how are you - always enjoy you responses - and yes Yay for sets - the broccoli (oft overlooked) Tableau functions

Jim

• ###### 12. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

Hey Jim Dehner!

I'm doing great here in Michigan. A little bird told me you're vying to be the next person that passes 100k! (you've got over 91k now: that's incredible-- and well-deserved!). I know you'll get there soon!

I'm a big fan of sets, but you're right: they really need a better publicist. Sets can do some incredible things! For those of you who might need some pointers, check out this link:

And with the new Set Actions feature, sets become even more useful. (I gotta brush up on those, though)

For my class, I describe Sets as the hokey-pokey of Tableau functions (as it's generally either IN or OUT before you shake it all about). And JEEPERS-- a good set can make fast work of some otherwise complex calculations.

I guess after all these years I should ask how to pronounce your last name. I'll sheepishly admit when I see your name pop up a voice in my head says "Time for dinner!" So is it "dinner" or "Day-ner" or something else completely?

What's shakin' all about with you?

• ###### 13. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

I am getting up there inpoints but to be honest its not about the points with me ( or Joe either)  - I just think the competitiveness of that is a little too much

The summer is over here - my Grandkids go back to school in a couple of weeks -

and thanks for asking it is Day-ner

Jim

• ###### 14. Re: Count Customers that only purchased product A not Product B and count customers that purchased A and B.

thank you, it works now and thanks for introduce the SET concept.

regards

Cat

1 2 Previous Next