top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Market Basket Analysis In Tableau

Tableau is not just about creating visualizations. Tableau is a very powerful BI tool, a tool which gives you insight about your data by analyzing it.


Market basket analysis is a data mining technique used by retailers to increase sales by better understanding customer purchasing patterns. It involves analyzing large data sets, such as purchase history, to reveal product groupings, as well as products that are likely to be purchased together.


To start with, we can consider that suppose we have to launch our own online store for clothing. Our goal now is to achieve the highest possible turnover with the store. In order to achieve it, we want the customer to buy as much as possible.

One way to suggest the customers to buy more products is to use market basket analysis. Market basket analysis gives an answer to the question:

How likely it is that a customer will buy Product A if he or she already has Product B in their shopping cart?

Market basket analysis tells which products or goods are often bought together.

For eg, if a customer has pant and shoes in his cart, how likely is it that he will buy a shirt and socks also along with it?


In market basket analysis (also called association analysis or frequent item set mining), you analyze purchases that commonly happen together. For example, people who buy bread also buy butter. Or people who buy shampoo might also buy conditioner. What relationships there are between items is the target of the analysis. Knowing what your customers tend to buy together can help with marketing efforts and store/website layout.


Market Basket Analysis influences how retailers institute sales promotions, loyalty programs, cross-selling/up-selling and even store layouts.

If a retailer observes that most people who purchase Coca-Cola also purchase a package of Doritos , then it may not make sense to discount both items at once as the consumer might have purchased the associated item at full price anyhow. Understanding the correlation between products is powerful information.


We’ll use Tableau Superstore data to perform a simple market basket analysis.


Step 1.

Upload the data in Tableau and create an inner join with the same dataset keeping ‘Order ID’ as the key.




Step 2.

Next step is to select Product Sub-category from Orders with Product Sub-category from Orders 1. We use ‘Not Same Product Sub-Category’. The reason for doing is to create a cross tab where we can see what all product sub categories are together and their impact on their combination.



Step 3.

Now, will select Sub- Category from Orders, and drag it to rows, and Sub- Category from Orders1 to columns. We have this blank diagonal across the middle where our accessories are not equal to our accessories and so on.



Step 4.

We will add CountD of Order ID to the Text and to the colors from Orders and change our chart to square under the marks.



Step 5.

We can see the Null column also being displayed. So, will drag the Sub- category from Order 1 to filters and remove the null values.


Step 6.

We can see the same number on both sides of our chart, we want to avoid the section on left hand side, to remove the redundancy. So we will again go back to our data source and change the Sub Category to less than equal to.




Step 7.

Now, checking our sheet, we now have all of our joins, and have binders connected to binders itself. In order to remove this, we will again go back to our data source and change the join to less than.



For eg, now we can see that the most orders are of binders with papers i.e. 275.



We can also flip it around, by using swap rows and columns in order to have our matrix back to the beginning.



Step 8.

We can also see which sub category is profitable. For this, we will drag Profit into colors and into tooltip and can now see that the binders together with paper makes a profit of $14,317 whereas envelopes with bookcases are at loss. So just that the items are correlated, doesn't means they're profitable according to tableau 'Superstore' dataset.



We now know what all products to bundle together to increase the top line for store.


Market Basket Analysis is one of the key techniques used by large retailers to uncover associations between items. It works by looking for combinations of items that occur together frequently in transactions. To put it another way, it allows retailers to identify relationships between the items that people buy.


Retailers can use the insights gained from this in a number of ways, including:

  1. Cross Sell: Group products that customers purchase frequently together in the store’s product placement

  2. Web stores: Recommend associated products that are frequently bought together. “Customers who purchased this product also viewed this product…”

  3. Marketing Promotions: Target marketing campaigns to customers and entice them to purchase related products for items they purchased recently

Other Uses for Market Basket Analysis In addition its popularity as a retailer’s technique, it is applicable in many other areas:

  • Manufacturing: predictive analysis of equipment failure

  • Pharmaceutical/Bioinformatics: discovery of co-occurrence relationships among diagnosis and pharmaceutical active ingredients prescribed to different patient groups

  • Financial/Criminology: fraud detection based on credit card usage data

  • Customer Behavior: associating purchases with demographic and socio-economic data

As industry leaders continue to explore the technique’s value, a predictive version of market basket analysis is making in-roads across many sectors in an effort to identify sequential purchases.


1,702 views1 comment

+1 (302) 200-8320

NumPy_Ninja_Logo (1).png

Numpy Ninja Inc. 8 The Grn Ste A Dover, DE 19901

© Copyright 2022 by NumPy Ninja

  • Twitter
  • LinkedIn
bottom of page