Overview
Definition
Market basket analysis is an analysis method that associates two different products and explores their relations by analyzing user consumption data.
You can calculate the lift under the guidance of this document. If the lift is greater than 1, the two products are highly correlated, indicating that the combination of the two products is effective. In this case, they can be considered to be sold together.

Application
Identify customers' purchasing patterns.
Will the purchase of product A by users have any impact on product B?
Do different users have different purchasing patterns?
Which products should be bundled together for sales?
Expected Effect
For details about the dashboard, see Market Basket Analysis.
Implementation Method
Association analysis is measured by the following indicators.
Definition | Probability | Example | |
Support | Support refers to the probability that both product A and product B are purchased at the same time, or the proportion of the purchase times of a certain product combination to the purchase times of all products. Support indicates how representative the association rule is in all transactions. The greater the support is, the more important the association rule is. | Support of product A to product B P(A ∩ B) | Among today's total 10 orders, milk and bread are purchased together for six times. The support of the milk and bread combination is 6/10 (60%). |
Confidence | Confidence refers to the conditional probability of purchasing product B after purchasing A. Briefly speaking, it is the probability of purchasing product B due to the purchase of product A. | Confidence of product B to product A P (B|A) | Among today's total 10 orders, product A is purchased for eight times and product A with B are purchased together for six times. The confidence is 6/8 (75%). |
Lift | Lift refers to the promotion effect of purchasing product A on purchasing product B. Lift is used to assess if the combination of products is practically valuable, namely, if the combination of products is purchased more frequently than the individual product. The combination is considered effective if the value is greater than 1 and ineffective if the value is smaller than 1. | L = P(A ∩ B)/[P (A) * P (B)] | Among today's total 10 orders, product A is purchased for eight times, product B is purchased for six times, and product A and product B are purchased together for six times. The lift is 0.6/(0.8*0.6), which is 1.25 (> 1). Therefore, the combination of product A and B is effective. |
Support = Number of orders with product A and product B purchased together/Total number of orders
Confidence = Number of orders with product A and product B purchased together/Number of product A purchased
Lift = Support/((Number of product A purchased/Total number of orders) * (Number of product B purchased/Total number of orders))
Example
Sample data:Product Sales Table.xlsx
Obtaining Product Combinations by Join
Set Document Code to Merge Basis to obtain all product combinations in the order.
1. Create an analysis subject, and add the dataset Product Sales Table. For details, see Get Started with FineBI.
2. Add data, and select Document Code and Product Name, as shown in the following figure.
3. Add Product Sales Table again, click Join, and select Document Code and Product Name from Product Sales Table 1 to join the two datasets, as shown in the following figure.
4. Click Left Join, and select Document Code as Merge Basis, as shown in the following figure.
5. Click Field Settings to rename fields. Change Product Name to Product A Name and Product Sales Table 1 - Product Name to Product B Name, as shown in the following figure.
Calculating Required Indicators
According to section "Implementation Method", the required indicators include the number of orders with product A and product B purchased together, the number of product A purchased, the number of product B purchased, and the total number of orders.
Calculating the Number of Product A Purchased
Click Summary Column, and set Group Field to Product A Name, Summary Field to Document Code, and Summary Method to Distinct Count to obtain the number of product A purchased, as shown in the following figure.
Calculating the Number of Product B Purchased
Click Summary Column, and set Group Field to Product B Name, Summary Field to Document Code, and Summary Method to Distinct Count to obtain the number of product B purchased, as shown in the following figure.
Calculating the Number of Orders with Product A and Product B Purchased Together
Click Summary Column, and set Group Field to Product A Name and Product B Name, Summary Field to Document Code, and Summary Method to Distinct Count to obtain the number of orders with product A and product B purchased together, as shown in the following figure.
Calculating the Total Number of Orders
Click Summary Column and set Summary Field to Document Code and Summary Method to Distinct Count to obtain the total number of orders, as shown in the following figure.
All the basic indicators mentioned above — Number of Orders with Product A and B Purchased Together, Number of Product A Purchased, Number of Product B Purchased, and Total Number of Orders — have already been calculated. Then you only have to calculate support, confidence, and lift.
Calculating Support, Confidence, and Lift
Calculating Support
Click Formula Column, set Name of Added Formula Column to Support, and enter the formula Number of orders with product A and product B purchased together/Total number of orders, as shown in the following figure.
Calculating Confidence
Click Formula Column, set Name of Added Formula Column to Confidence, and enter the formula Number of orders with product A and product B purchased together/Number of product A purchased, as shown in the following figure.
Calculating Lift
Click Formula Column, set Name of Added Formula Column to Lift, and enter the formula Support/((Number of product A purchased/Total number of orders) * (Number of product B purchased/Total number of orders)), as shown in the following figure.
Removing the Combination with the Same Product A and Product B
It is meaningless to calculate the support, confidence, and lift when the value of Product A Name is the same as that of Product B Name in a combination. You can filter out the combinations of the same products, as shown in the following figure.
Save and update the analysis subject after completing the steps.
Component Creation
1. Use the saved subject Market Basket Analysis to create a component. Select Custom Chart, and drag Product A Name into the horizontal axis and Product B Name into the vertical axis.
Select Rectangular Block in Graphic Property, and drag Support into the bar next to Color. Since graphing will result in the addition of values from multiple orders, you need to set Summary Mode to Average for Support dragged into the bar, as shown in the following figure.
2. Create another component to display the detailed data of support, confidence, and lift, as shown in the following figure.
Set Summary Mode to Average for support, confidence, and lift due to the merging summary of multiple orders. Set Value Format to Percentage, as shown in the following figure.
Effect Display
For details, see section "Expected Effect."