反馈已提交

网络繁忙

You are viewing 5.1 help doc. More details are displayed in the latest help doc.

ACC_SUM

  • Recent Updates: May 12, 2022
  • 1. Overview

    1.1 Version

    FineBI VersionJAR PackageFunction Changes
    5.1--
    5.1.72020-11-05Function definition optimization & specify the validity of function parameters.

    1.2 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.3 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.


    Attachment List


    Theme: Advanced Data Analyis
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    售前咨询电话

    400-811-8890转1

    在线技术支持

    在线QQ:800049425

    热线电话:400-811-8890转2

    总裁办24H投诉

    热线电话:173-1278-1526

    文 档反 馈

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭