ACC_SUM

  • Last update:  2023-05-15
  • 1. Overview

    1.1 Expected Effect

    For example, given the daily number of stocks bought and sold, it is necessary to count the cumulative number of remaining stocks each month, as shown in the following figure:

    16.png

    1.2 Implementation ideas

    Use the ACC_SUM function.

    2.Concept

    GrammarACC_SUM(x_agg(array),range)According to the added fields of the horizontal and vertical axis or the row and column dimensions, the indicator is calculated for the cross-row accumulation.
    Parameter1x_agg(array)

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

    Parameter2range

    The second parameter range is the calculation range set by the user, 0 is to accumulate all rows, and 1 is to accumulate all rows in the group.

    3. Examples

    stock trading data.xlsx

    3.1 Calculate the monthly accumulated remaining number

    Knowing the daily number of stocks bought and sold, it is necessary to count the number of remaining stocks each month.

    Drag "Date" into the dimension column and set it to the "Year Month" format, and drag "Buy" and "Sell" into the indicator column, as shown in the following figure:

    17.png

    Add a calculation indicator and name it "Cumulative remaining stocks", enter the formula: ACC_SUM(SUM_AGG(buy-sell),0), click "OK", as shown in the figure below:

    18.png

    Formula description:

    FormulaDescription
    SUM_AGG(buy-sell)The daily buy-sell difference is summed and summarized according to the "year month" dimensions.
    ACC_SUM(SUM_AGG(buy-sell),0)Take the month as the unit, accumulate all the values of the daily buying and selling differences from top to bottom.

    You can see that the cumulative value of "2016-01"  equals to "-469+2562=2093", as shown in the figure below:

    19.png

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

    3.2 Effect view

    See section 1.2 of this article for details.


    附件列表


    主题: Advanced Data Analyis
    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