Saturday, August 20, 2016

Counting Customers Who Bought The Same Products

I wrote previously a post on how to count customers who bought both A and B. Today someone asked how to count those who all bought the same N items. N>=2. He specifically requires a multiple choice filter so that people can select some items and only those who bought them all are showing. (All right, the problem is paraphrased.)

In the previous post, the purpose is to map out the tallies for all possible pairs of products and to study the correlation between products. Here we only need to show the customers who bought one set of products.

We will use the Superstore data set as an example. In the data set, there are 17 subcategories. We will show how to list or count the customers who bought the same set of subcategories of products.

The main steps are as follows:
1.Right click the Sub Category filter and make it a context filter.
Only those who bought any one of the sub categories are kept using this filter.
2.Show Sub Category filter and select only 2 of the sub categories. (You can select more after step 4.)
3.Apply the following filter:
This filter will only keep those who bought exactly the same set of selected subcategories.

4.Select True when prompted. If you don't see True, do these:
- Show filter
- Click the drop down menu of the filter
- Select "All values in context"
Caveat: don't select too many subcategories in the same time. Otherwise, you might see a blank screen because no one bought all sub categories of products. Start by selecting any 2 sub categories.

Last, this LOD formula will give us the number of total customers who bought the same products.
You can play with and download the interactive workbook here.

8 comments:

  1. This technique converts the multiple choice filter from "A or B or C" to "A and B and C" filter.

    ReplyDelete
  2. Hi, thanks for sharing.

    Since it works on a LOD calculation , if I want to check the number of customers who purchased in a particular time interval (for eg. only last month) , how can I do it?

    ReplyDelete
    Replies
    1. Create a context filter using the date dimension. That should do it.

      Delete
  3. How to I count when specific products are purchased together from a massive list of products? (ie, without specifying the sub categories)

    ReplyDelete
    Replies
    1. define your granularity. product level is good too if that's what you like to measure. you can create subcategory artificially, then sub-categorize the products and compare at the subcategory level.

      Delete