Cross-Selling Rate Calculation of Market Basket

  • Last update:July 19, 2024
  • Overview

    Background

    You consider each order a market basket and want to determine the association between one product and another. In that case, you can calculate the cross-selling rate.

    If you use the market basket analysis to calculate association relationships, you need to use table joins (n:n), which can cause data inflation and is not suitable for a large data volume.

    Therefore, if your data volume is large, you are advised to use the method described in this document to calculate the association relationships of the market basket.

    Expected Effect

    If you want to know the cross-selling rate of tomatoes with other products, namely to find out the products most related to tomatoes, you can select Tomato in the following dashboard to view the proportion of the sales quantity (related to tomatoes) for each product to the total sales quantity.

    You can click and view the online demo: Cross-Selling Rate Calculation of Market Basket.

    41f28bb44a3728db428d0d48a5c6893.png

    Procedure

    Data Preparation

    Create an analysis subject and use the sample data Group merchandise sales summary, as shown in the following figure.

    图片1.png

    Judging Whether the Order Contains Data on Tomatoes

    Go to the component page. Create a calculation field named Whether the Order Contains Data on Tomatoes, as shown in the following figure.

    472a57ea99548d760cb64dfe7409a03.png

    4516d03e604434d56231ed24133bcdf.png

    Formula

    Description

    Reference

    If (Product name = "tomato", Product name, null)

    If the value in the field Product name  

    is not Tomato, the field is assigned a 

    null value; if the value is Tomato, the 

    field is assigned the value Tomato.

    IF

    COUNTD_AGG (If (Product name = 

    "tomato", Product name, null))

    The formula is used to perform a 

    deduplicated count on the product.

    Since the field Product name 

    (without the value tomato) is assigned a null value, the count comes out to be 1.

    COUNTD_AGG

    DEF (COUNTD_AGG (If (Product 

    name = "Tomato", Product name, 

    null)), [Document code] )

    The formula is used to judge whether 

    each record of the document code 

    contains data on tomatoes. If data on 

    tomatoes are present, the document 

    record is marked as 1.

    If data on tomatoes are not present, 

    the document record is marked as 0.

    DEF (Specified Dimension)

    Creating a Column Chart

    1. Use a stacked column chart to display the sales quantity for each product. Set Chart Type to Stacked Column Chart, drag fields into the analysis area, and set Horizontal Axis to Indicator Juxtaposition.

    05c43e5ac3fd1decd74312bd7d41d98.png

    2. Copy the field Whether the Order Contains Data on Tomatoes to obtain the field Whether the Order Contains Data on Tomatoes1, click the 30079c11f5781f9ae07a2225f413d5c.png icon next to the obtained field, and select Convert to Dimension from the drop-down list.

    997030ed10301c7b04aee20482435c1.png

    3. Drag the field Whether the Order Contains Data on Tomatoes into Graphic Property > Color. Click the 2e31d3b46075e7d1b0f9de6b27e8e96.png icon next to the dragged field and choose Descend > Whether the Order Contains Data on Tomatoes from the drop-down list. Re-click the 2e31d3b46075e7d1b0f9de6b27e8e96.png icon and select Group Records with Same Value.

    54d0039956bf1684e5245b25551c865.png

    4. Click the 30079c11f5781f9ae07a2225f413d5c.png icon next to the field Quantity in Horizontal Axis and select Enable Stacking from the drop-down list.

    In this way, the total length of each column represents the total sales quantity for each product. The column with the legend labeled as 1 represents the sales quantity of products in orders that contain data on tomatoes. You can roughly judge the cross-selling effect of tomatoes on the sales of each product by viewing the proportion of each column.

    5ef501e75780afe25c5c73ce308b8f2.png

    Calculating the Cross-Selling Rate of Tomatoes with Other Products

    Relying solely on the length of the column chart to judge the cross-selling rate of tomatoes with the sales of other products is not accurate enough. You can calculate the numerical values.

    The cross-selling rate of the sales quantity = The sales quantity of the product in the order that contains data on tomatoes (cross-selling quantity) / The total sales quantity of the product

    1. Calculate the sales quantity of each product in orders that contain data on tomatoes.

    Create a calculation field named Cross-Selling Quantity and enter the formula, as shown in the following figure.

    95f99758fc85978498f61e996c8635a.png

    Formula

    Description

    Reference

    DEF (SUM_AGG(Quantity), 

    [Product Name], [Whether the 

    Order Contains Data on Tomatoes=1])

    The formula is used to group the   data by product names and filter and calculate the orders that contain data   on tomatoes.

    DEF (Specified Dimension)

    iconNote:
    The field Whether the Order Contains Data on Tomatoes in the filtering condition is the indicator field, not the copied and converted dimension field Whether the Order Contains Data on Tomatoes1.

    2. Calculate the total sales quantity for each product.

    Create a calculation field named Total Quantity and enter the formula, as shown in the following figure.

    42c0d92ba0b86864fc3aa9c4ad2205a.png

    3. Calculate the cross-selling rate of tomatoes (The cross-selling quantity / The total quantity). Add a calculation field and enter the formula, as shown in the following figure.

    19b795d3784fe2c6014ca3be15beaf5.png

    4. Switch Chart Type to Custom Chart, drag the field Cross-Selling Rate to Horizontal Axis, and set Horizontal Axis to Indicator Aggregation.

    Change the display format of the field Cross-Selling Rate to Line and drag the field Whether the Order Contains Data on Tomatoes out of Graphic Property > Color.

    Click the 30079c11f5781f9ae07a2225f413d5c.png icon next to the field Cross-Selling Rate in Horizontal Axis, select Set Value Axis from the drop-down list, and set Shared Axis to Upper-value Axis. Re-click the 30079c11f5781f9ae07a2225f413d5c.png icon, select Value Format from the drop-down list, and select Percentage.

    8e4b5a483d0a55e28213d40e6ad324e.png

    In this way, you can view the cross-selling effect of tomatoes on other products.

    Although you can view the cross-selling effect of tomatoes on other products now, you also want to view the cross-selling effects of carrots and cabbages on other products.

    At this time, you can consider changing the value Tomato to the values of other products with parameter.

    Changing Products with Parameters

    Adding a Parameter

    1. To make it easy to change data on tomatoes to data on carrots and cabbages for viewing the cross-selling effects on other products, you can change the parameter value Tomato.

    Create a parameter and set Parameter Type to Text, as shown in the following figure.

    图片2.png

    2. Use the created parameter to change the original parameter (Tomato) in the formula of the calculation field Whether the Order Contains Data on Tomatoes, as shown in the following figure.

    669d6cc6416fbbce376d052fca98d64.png

    3. Delete the field Whether the Order Contains Data on Tomatoes1, re-copy the field Whether the Order Contains Data on Tomatoes with the parameter in the formula replaced, and convert the field type of the re-copied field to the dimension type. Replace the fields with the ones in the chart, same as step three in section "Creating a Column Chart."

    Assigning Values to Parameters with Filtering Components

    1. Add the FineBI built-in data ENdemo_Product_Dimension_Table to the current subject.

    192c0fff0273406dc924e5b7b2143a7.png

    2. Create a dashboard, add the filter component Text List, and bind the created parameter.

    You need a text list of the field Product name to facilitate selecting and assigning values to parameters. However, you cannot directly use the fields (which may filter the current component if used) in the current table, so you can add another table and bind the Product name field of the added table to the filter component.

    1209186e523f2d0b303c837b06a2360.png

    图片3.png

    3. Click OK, drag the completed component into the dashboard, and select the Carrot in the text list to view the cross-selling effect on other products.

    f3cda2b9c126447e3a1cbdb4d438f3e.png

    4. Go to the component page, click the 2e31d3b46075e7d1b0f9de6b27e8e96.png icon next to the field Product name in Vertical Axis, and select Filter from the drop-down list to filter out the products with values same with the parameter value of the column chart, as shown in the following figure.

    5852c08f239d64ac589a89a655500f5.png

    b30b3db624c11336b90cd99bafa7a1e.png

    Effect Display

    For details, see section "Expected Effect."

    附件列表


    主题: Advanced Data Analysis
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy