Get Ready For Your Tableau Certification
  • Bernard

How many customers bought a certain combination of products?


computing the number of customers bought a certain combination of products

This is a common question in retail industry - when one is interested to know how many customers ordered certain items together.

Let’s build a case.

Sample data

(The above sample data contains four columns – i.e., Id, Order Id, Customer Name and Product. Order Id represents each order by customers – with some of the orders containing several products).

(You can populate similar data to follow along)

The problem

In this case, using data in the above snapshot, lets find the customers who ordered a ‘Chair’ and a ‘Table’ at the same time.

Tableau training

The Solution

First let’s create a calculation that will return ‘Chair’ and ‘Table’ while bundling the rest of products as nulls.

tableau calculated field

Next, let’s create a calculation that returns true for orders containing two unique products (i.e., Chair & Table) while returning False for order containing one or zero unique products.

Add the above calculation as a filter and select ‘TRUE’.

For this case, the above calculation has been used as a filter in the following view.

customers who ordered certain products together

We can therefore say, for this sample data. Three customers namely, James Kilo, Keith and Kelly ordered a Chair and a Table together.

I hope this was helpful to you.

To receive more of the Tableau tips, kindly join our mailing list by subscribing below.

Thank you for reading.

LEAD MAGNET - 2.png
FREE INTRO COURSE -2.png