TOTAL

  • Last update:May 15, 2023
  • 1. Overview

    1.1 Application scenarios

    For example, calculate the sum of the order amounts of different ship methods in every year.

    Combine with other quick calculation functions to calculate the proportion within the group, the accumulated proportion within the group, and so on.

    1.2 Implementation ideas

    Use the TOTAL function.

    2. Concept

    Grammartotal(x_agg(array), range, agg)Perform cross-row summary calculation of indicators based on the added fields on the horizontal and vertical axis or row and column dimensions.
    Parameter1x_agg(array)

    The first parameter is the indicator calculated by the user, which must be an aggregate function or aggregate indicator.

    Parameter2rangeThe second parameter range is the calculation range set by the user, 0 means summarizing all rows, and 1 means summarizing all rows in the group.
    Parameter3aggThe third parameter agg is the calculation rule of the summary, "sum" is the sum; "avg" is the average, "max" is the maximum value, and "min" is the minimum value.

    Note: The third parameter supports SUM, AVG, MAX, MIN, and is not case sensitive.

    3. Examples

    3.1 Calculate the summary value within the group

    1) Calculate the aggregate value of the "AMOUNT" of different ship methods in every year, for example, calculate the aggregate value of the amount in the group of year 2008, as shown in the following figure:

    20.png

    For the writing of functions, please refer to: Function Calculation Format.

    3.2 Calculate the proportion within the group

    Continue to calculate the "proportion within the group" to calculate the proportion of the amount of different ship methods in the same year: SUM_AGG(AMOUNT)/TOTAL(SUM_AGG(AMOUNT),1,"sum") , as shown in the following figure:

    21.png

    Formula description:

    FormulaDescription
    SUM_AGG(AMOUNT)The amount summarized in the group according to the year and "SHIPMETHOD".
    TOTAL(SUM_AGG(AMOUNT),1,"sum")Calculate the sum of the amount of all ship methods in the same year.
    SUM_AGG(AMOUNT)/TOTAL(SUM_AGG(AMOUNT),1,"sum")Annual amount of each ship method/ summary value of amount of all ship methods in the current year.

    For the writing of functions, please refer to: Function Calculation Format.

    3.3 Calculate the accumulated proportion within the group

    Calculate the "accumulated proportion within the group", enter the formula: ACC_SUM(SUM_AGG(AMOUNT),1)/TOTAL(SUM_AGG(AMOUNT),1,"sum"), as shown in the figure below:

    22.png

    Formula description:

    FormulaDescription
    ACC_SUM(SUM_AGG(AMOUNT),1)Calculate the accumulated value of the amount of different ship methods in the same year.
    TOTAL(SUM_AGG(AMOUNT),1,"sum")Calculate the sum of the  amount in the same year
    ACC_SUM(SUM_AGG(AMOUNT),1)/TOTAL(SUM_AGG(AMOUNT),1,"sum")accumulated value/summary value

    4. Notice

    If you calculate the summary value of the "AMOUNT" in the self-service dataset, you can add a column and select "All Values/Within the group" to set the sum of total amount, as shown in the figure below:

    23.png

    Since the data here is a calculation of detailed data, the result will not be changed due to dimensional changes. The results are as follows:

    24.png

    附件列表


    主题: Advanced Data Analysis
    Previous
    Next
    • 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