PREVIOUS_PERIOD

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

    1.1 Expected effect

    It is hoped to realize the display of the "circular period" value. For example, the value of the period in June 2008 will be displayed in the previous month: the order amount in May 2008, as shown in the figure below:

    13.png

    1.2 Implementation ideas

    Use the PREVIOUS_PERIOD function.

    2. Concept

    Grammarprevious_period(x_agg(array))Calculate the circular period value based on the date field added in the horizontal and vertical axis or row and column dimensions.
    Parameterx_agg(array)

    The parameter is the indicator used for calculation, and the indicator must be an aggregate function or aggregate indicator. 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.

    3. Example

    previous_period(sum_agg(AMOUNT)): the "SIGNDATE" dragged by the user on the horizontal and vertical axis ("Year Month Day" grouping), then the calculation result of this indicator is that the "AMOUNT" is grouped and summarized according to the "Year Month Day", and then the data for the last day's amount is calculated. 

    Sample data: "Sales DEMO>FRDemo_ORDERS". 

    3.1 Calculate the monthly circular period amount 

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

    14.png

    Add a new calculation indicator named "circular period", enter the formula: PREVIOUS_PERIOD(SUM_AGG(AMOUNT)), as shown in the figure below:

    15.png

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

    3.2 Effect view

    You can drag the calculation indicator into the indicator column, so the circular period value in June 2008 is the amount of the last month: May 2008. For details, see Section 1.2 of this article.

    附件列表


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