Calculating Proportion in Group - Indicator

  • Last update:  2024-01-18
  • Overview 

    Application Scenario 

    Group the data by Dimension A, classify the data within the group by Dimension B, and calculate the indicator proportion within the group. For example, you may want to group the sales data by year and calculate the sales volume proportion of each type of product in corresponding years. The effect preview is as follows.

    Documents on calculating the proportion within groups are listed in the following table.

    Proportion-in-Group Indicator Available in Source DatasetExampleRecommended Document
    YesYou need to calculate the sales volume proportion of various types of products in recent years. There is a Sales Volume field in the dataset.

    Calculating Proportion in Group - Indicator

    iconNote:
    Indicators refer to the fields in the indicator bar in the analysis area during the component making, usually of the value type.


    NoYou need to calculate the proportion of self-owned fashion stores in each region. There is no Store quantity field in the dataset, but there is a Store name field.Calculating Proportion in Group - Dimension

    Function Introduction 

    You can calculate the proportion in a group using the Quick Calculation function or using functions, where the former is easier to implement. 

    Calculating Proportion in Group Using Quick Calculation

    When making a component, you can choose Quick Calculation > Proportion in Group in the drop-down list of a target field to obtain the in-group proportion of the indicator data, as shown in the following figure. 

    Calculating Proportion in Group Using Functions

    By adding calculation indicators, you can also get the in-group proportion by adding formulas, as shown in the following figure.

    Calculating Proportion in Group Using Quick Calculation 

    You can use the example data: Year_Month_ Sales.xls.

    The proportion in the group is calculated on the component editing interface. Upload the data and create a component to enter the component editing interface.

    Data Uploading 

    Create a new subject.

    Click Local Excel and Upload Data, as shown in the following figure.

    Change the field type of Year to Text after you add the Year_Month_Sales dataset, as the sales volume will be analyzed by the Year dimension during the component creation.

    iconNote:
    Value-type fields cannot be used as the analysis dimension, and can only be used as the analysis indicator.

    Change the field type of Month to Text, and then click OK to complete the data uploading. 

    Component Creation 

    Create a component.

    Component Making 

    The expected effect is that the data is grouped by Year, and the sales volume of different products can be viewed according to Product Name. You can use Product Name and Sales Volume to turn the chart into a pie chart as a pie chart requires one dimension and one indicator, and then use the Year field to group the data by year.

    Drag the Product Name field into the Dimension bar and the Sales Volume field into the Indicator bar, as shown in the following figure.

    Choose Quick Calculation > Proportion in Group to display the calculation results of the proportion of Sales Volume within the group. 

    Click the pie chart icon to switch the chart to a pie chart. 

    Drag the Year field into the Horizontal Axis after the chart turns into a pie chart. The sales volume proportion of different products is displayed in the component preview area by year. 

    Component Beautifying 

    You can beautify the component as needed to better display the analysis results. For details, see Graphic Properties.

    Add a calculation indicator. Drag the Sales Volume field into the Label bar, and choose Quick Calculation > Proportion in Group, as shown in the following figure.

    Set the label location. Click Label and set Label Location to Outer, as shown in the following figure.

    Set the format of the label value to percentage. Click the icon beside the field in the Label bar, click Value Format, set it to Percentage, and click OK

    Modify the color of the pie chart. Click Color to modify the color scheme, as shown in the following figure.

    Drag the component into a dashboard after you finish the component creation and beautification.

    Effect Display 

    On PC

    For the component effect, see the Application Scenario section in this document.

    On Mobile Terminals

    The effect is shown as follows.

    Calculating Proportion in Group Using Functions 

    You can use the same example data.

    The proportion in the group is calculated on the component editing interface. Upload the data and create a component to enter the component editing interface.

    Adding a Calculation Indicator 

    Go to the component editing interface and add a calculation indicator. 

    Add a formula  SUM_AGG(Sales Volume)/TOTAL(SUM_AGG(Sales Volume,1,"sum") to get the proportion of the grouped sales volume to the total sales volume. Name the indicator field Proportion in Group, and click OK.

    iconNote:
    Select the Sales Volume field from the left field column. Manual input is invalid.

    The following table explains each part of the above formula.

    FormulaDescriptionFunctionFunction Definition
    SUM_AGG(Sales Volume)Group and summarize the sales volume by dimension to generate group summary rows.SUM_AGGReturn the summary sum value of the indicator field according to the current analysis dimension. 
    TOTAL(SUM_AGG(Sales Volume),1,"sum")Perform cross-row summary calculation of the group summary rows to get the total sales volume of all products.TOTAL()Perform cross-row summary calculation of the given indicators based on the field added to the horizontal and vertical axes or row and column dimensions.

    Creating a Pie Chart 

    Drag the Product Name field into the Dimension bar, and the Proportion in Group field into the Indicator bar, and click the pie chart icon to create a pie chart. 

    Drag the dimension field Year into the Horizontal Axis to group the data by year. 

    The effect is the same as that created by using the Quick Calculation function.


    附件列表


    主题: Creating a Visual Component
    • 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