SUM_AGG

  • Last update:April 03, 2023
  • Overview

    SUM_AGG function is used to summarize and add up data for the specified dimension (dragged into the analysis column). The calculation field will make  dynamic adjustment automatically when you switch the analysis dimension.


    GrammarParameter
    Description
    SUM_AGG(array)array
    Return the summary sum value of the indicator field according to the current analysis dimension. The result generated is a data column with the same number of rows as that of current analysis dimension.The result must be returned by a non-aggregate function formula. It can be the calculation result of an indicator field/dimension and a regular formula.

    Notes

    It can only be used when you create a calculation field in a dashboard.

    Using SUM_AGG Function to Calculate the Average

    SUM_AGG is generally used for summation after detail filtering and division after summation. If you only need to sum up a single value, you can drag and drop the field to the indicator. It will automatically sum up.

    If the dimension field in the lateral axis is Day, the value returned by the calculation field SUM_AGG(sales) in the vertical axis is the total sales for each day.

    If the dimension field in the lateral axis is Month, the value returned by the calculation field SUM_AGG(sales) is the total sales for each month.

    For example, you have obtained the contract amount and purchase quantity for each year from 2011 to 2017 through the group table. In addition, you want to calculate the average amount for each year.

    1.png

    Add a calculatdion field named SUM_AGG and input the formula SUM_AGG(contract amount)/SUM_AGG(purchase quantity) as follows:

    2.png

    Drag SUM_AGG field to Indicators.

    3.png

    Formula explanation:

    Since the current analysis dimension is the Contract Signing Time (Year), the meaning of the formula is as follows:

    Formula

    Description

    SUM_AGG(contract amount)

    The returned value is the summation of annual contract amount.

    SUM_AGG(purchase quantity)

    The returned value is the summation of purchase quantity for each year.

    SUM_AGG(contract amount)/SUM_AGG(purchase quantity)

    It is the average amount per year.

    For example, average amount in 2013 = 3887220/41.

    The total contract amount for the year 2013 is 3,887,220 and the purchase quantity is 41.

    Using Other Formula to Calculate the Average

    Comparison of Formula Principles

    Since the current analysis dimension is Contract Signing Time (Year), take the average amount of the contract in 2013 as an example. The formula meaning is shown as follows:

    Formula

    Calculation Order

    contract amount/purchase quantity

    Calculate the average value of each contract in 2013 and then summarize and sum up the average value of all contracts.

    SUM_AGG(contract amount)/SUM_AGG(purchase quantity)

    Summarize the contract amount and purchase quantity in 2013 and then divide the summation value of contracts in 2013 by the summation value of purchase quantity in 2013 to obtain the average value of contracts in 2013.

    Example

    To help you better understand the SUM_AGG function, a comparison is made between not using it and using it in the same scenario.

    Add a calculation field named Other Formula and directly use the formula contract amount/purchase quantity to calculate the average value.

    4.png

    Drag and drop Other Function field to Indicators and the result is shown as follows:

    5.png

    Obviously, the result obtained without using the SUM_AGG function is to divide the detailed data and then summarize and sum up it.


    附件列表


    主题: 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