Lift a chestnut! Tableau Trise (127): Shopping Basket Analysis of Market Basket Analysis
published: 2021-06-08 16:44

Shopping basket analysis (Market Basket

Analysis) Research on its purchase behavior through customer shopping basket information. The main purpose is to find something like something should be put together. By analyzing customers' purchase behavior to explore customer's properties and the possible causes of purchases of certain goods, identify relevant Lenovo rules, companies can use these rules to better excavate commercial interests and establish competitive advantage.

The most common shopping basket analysis of data powder is associated with the associated purchase analysis: by analyzing sales data, understand the number of people or the number of orders simultaneously purchased, thereby carrying reasonable product delivery.

The most famous shopping basket analysis is a story of "Beer and Diaper", which is a typical associated purchase analysis scene.

Image from the network

So, in Tableau, how to achieve shopping basket analysis?

Today, we share with two examples: How to combine in the Tableau to use the LOD function and filter to achieve the analysis of associated purchase.

The Tableau tricks we have to share with you this issue are: shopping basket analysis of Market Basket Analysis.

For the convenience of learning, chestnuts use Tableau to own the "example-supermarket" data source. After mastering the chestnut method, the data powder can try to use its own data.

Specific steps are as follows:

【 Number of orders purchased at the same time】

The first example, presenting the number of orders that simultaneously purchase multiple subcategories products.

1. Open Tableau Desktop, connect "Example - Supermarket" data source. Then, drag and drop the dimension "subcategory" to the filter. Right click on "Subcate" capsules on the filter, click Edit Filter in the drop-down menu. In the "Filter [Subcate]" dialog box pop-up, select "All".

 

2. Right-click the "Subcategory" capsule on the filter, click Show Filter in the drop-down menu. Then, in the filter on the right side of the Worksheet View, click the "Subcategory" right small triangle, check "Multi-value (drop-down list).

 

3. Drag and drop the dimension "Order ID" in "text" of the tag card, then click the small triangle on the right side of the text "Order ID" to select "Measure" - "count (different)" in the drop-down menu.

 

At this point, the chart shows the number of rendering orders in all subcategories (as shown below).

 

When in the filter, the chart will display the number of cumulative orders for three subcategories products when checking "Tag - Phone - Copy Machines".

 

This is obviously not what we want, we want to buy these three subclasses at the same time. How to achieve?

4, next, create a calculation field: judgment true and false. Type functions:

{FIXED [Order ID]: countd ([subcategory])} = {countd ([subcategory])}

 

5, right-click the "subcategory" capsule on the filter, select "Add to Context" in the drop-down menu. Then, drag and drop the calculated field "judgment true and false" to the filter. Right click on "Judgment True" capsules on the filter, select "Edit Filter" in the drop-down menu, and check "true" in the pop-up dialog box.

 

TIPS: This is set here, which is to make the formula that determines true and false according to the results after subcategory filing. If you do not add, you will directly drag and drop the true and false fields, the 'pseudo' will be displayed.

In this way, we have to get the number of orders that purchase multiple subcategories at the same time.

 

【Customer accounting at the same time】

Second example, the number of people who purchase multiple subcaters simultaneously accounts for the ratio of the total number of people.

1. New worksheets, create new calculation fields: IF and total customers. The purpose of calculating the field IF is to find the number of customers who purchase multiple subcategories at the same time.

Type functions separately:

COUNTD(if

{Fixed [Customer Name]: countd ([subcategory])} = {countd ([subcategory])} the [customer name] END)

 

CountD ([Customer Name])

 

2. Drag and drop the dimension "subcategory" to the filter, right-click the "subcategory" capsule on the filter, and select "Add to Context" in the drop-down menu. Drag and drop the newly created calculation field "if" and "total number of customers" into the "Text" of the tag card, follow the display format of the text. In this way, it will be completed!

You can check different subcategories in the filters on the right side of the Worksheet view as needed, and view the number of customers who purchase their customers at the same time!

 

This issue of Tableau skills, have you get? Try it quickly!