反馈已提交

网络繁忙

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

SAME_PERIOD

  • Recent Updates: May 10, 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

    It is hoped to display the value of the "same period", for example, the value of the same period in June 2009 shows the value in June 2008, as shown in the figure below:

    10.png

    1.3 Implementation ideas

    Use the SAME_PERIOD function.

    2. Concept

    Grammar
    same_period(x_agg(array), datepart)Calculate the same period value based on the date field added by the horizontal and vertical axis or row and column dimensions.
    Parameter1x_agg(array)

    The first parameter is the indicator used for calculation, which must be an aggregate function or aggregate indicator.

    Parameter2datepartThe second parameter is used to calculate the same day of the year or the same day of the month when configuring the calculation of the same period. When the field dragged on the horizontal and vertical axis does not meet the calculation requirements of the function, the indicator will be marked in red.

    Note 1: The parameters support Y, M, W, and are not case sensitive.

    3. Examples

    If the user drags the sales date (grouped by year, month, and day) on the horizontal and vertical axis, the calculation result of SAME_PERIOD(SUM_AGG(AMOUNT), "Y") is that the sales are grouped and summarized according to the year, month, and day, and then the data on that day is calculated The sales volume on the same day of the year; if the parameter 2 is "M", the calculation result is the sales volume of that day on the same day of the previous month.

    Sample data: "Sales DEMO>FRDemo_ORDERS".

    3.1 Calculate the monthly amount for the same period

    To calculate the monthly amount for the same period, you need to change the grouping of the date field "SIGNDATE" as "Year Month", as shown in the following figure:

    11.png

    Add a new calculation indicator, named the "same period" field, and enter the formula: SAME_PERIOD(SUM_AGG(AMOUNT),"Y"), as shown in the figure below:

    12.png

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

    3.2 Effect view

    Just drag the calculated indicator into the indicator column, so the value of the same period in June 2009 will show the amount in June 2008. For details, please refer to section 1.2 of this article.

    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后关闭