Same Period/Previous Period Ratio Calculation (with Date Fields in Charts)

  • Last update:  2024-02-27
  • Overview

    Application Scenario

    You may want to display data of the same period and the previous period with the date field as the dimension field.

    For example, the following figure calculates contract amounts of the same period and the previous period based on the date field Time of Contract.

     开头.png

    The previous period ratio refers to the ratio of quantity changes in two consecutive statistical periods (such as two consecutive days/months). 

    Calculation formula: (Current Period-Previous Period)/Previous Period*100%

    The same period ratio generally refers to the ratio between quantity changes of a certain month in a specific year and those of the same month in the previous year. It also refers to the ratio between quantity changes of a certain day in a specific month and those of the same day in the previous month. 

    Calculation formula: (Current Period-Same Period)/Same Period*100%

    Implementation Method

    You can calculate the same period and previous period ratios in the following two ways.

    1. Use Quick Calculation. For details, see YoY/MoM Growth (Quick Calculation).

    2. Use Quick Calculation functions. For details, see Overview of Quick Calculation Functions.

    You are advised to use the first method.

    Ratio Calculation of the Same Period and Previous Period Using Quick Calculation

    Before performing the calculation, you need to create an analysis subject and upload the data.

    Ratio Calculation of the Previous Period

    1. Go to the component editing page, create a group table, and drag the Time of Contract field into Dimension.

    If you only want to view data of the same period and the previous period by month, you can set the grouping type of the Time of Contract field to Year-Month, as shown in the following figure.

    1.jpg

     

    2. Drag the Contract Amount field into Indicator twice, click the icon of any one of the fields, and choose Quick Calculation > Comparison with Same Period/Comparison with Previous Period > Growth Rate of Comparison with Previous Period.

     2.jpg

    3. Rename the field MoM Ratio of Contract Amount. The previous period ratio of the contract amount is successfully calculated, as shown in the following figure.

     3.png

    Ratio Calculation of the Same Period

    1. Copy the Contract Amount field, drag the copied field into Indicator, click the icon , choose Quick Calculation > Comparison with Same Period/Comparison with Previous Period > Growth Rate of Comparison with Same Period, and rename the field YoY Ratio of Contract Amount.

     4.png

    2. The same period ratio of the contract amount is successfully calculated, as shown in the following figure.

     5.png

    Ratio Calculation of the Same Period and Previous Period Using Quick Calculation Functions

    Use the same method to create a group table and add calculation indicator fields.

     6.jpg

    Ratio Calculation of the Previous Period

    The formula for the ratio calculation of the previous period is (SUM_AGG(Contract Amount)-Previous Period)/Previous Period. You need to calculate the value of Previous Period first.

    1. Add a calculation indicator field named Previous Period. You need to use the function PREVIOUS_PERIOD, as shown in the following figure.

    7.jpg

     

    2. Add a calculation indicator field named MoM Ratio.

    Use the Previous Period field to calculate the ratio of the previous period. Enter the formula (SUM_AGG(Contract Amount)-Previous Period)/Previous Period and set Field Name to MoM Ratio, as shown in the following figure.

    8.png

    3. Drag the MoM Ratio field into Indicator and set Value Format to Percentage. The ratio of the previous period is successfully calculated, as shown in the following figure.

    9.png 

    Ratio Calculation of the Same Period

    The formula for the ratio calculation of the same period is (SUM_AGG(Contract Amount)-Same Period)/Same Period. You need to calculate the value of Same Period first.

    1. Add a calculation indicator field named Same Period.

    You need to use the function SAME_PERIOD, as shown in the following figure.

     10.jpg

    2. Add a calculation indicator field named YoY Ratio.

    Use the Same Period field to calculate the ratio of the same period. Enter the formula (SUM_AGG(Contract Amount)-Same Period)/Same Period, and set the Field Name to YoY Ratio, as shown in the following figure.

     11.png

    3. Drag the YoY Ratio field into Indicator and set Value Format to Percentage.

     12.png

    Further Reading

    If you only want to display data of the same period and the previous period at a specific time, you can refer to Filtering and Displaying the Same/Previous Period Ratio of a Self-Defined Date.

     


    Attachment List


    Theme: 可視化コンポーネントの作成
    前の記事
    次の記事
    • いいね
    • 良くない
    • 閲覧しただけ

    フィードバック

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

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

    不再提示

    9s后关闭

    反馈已提交

    网络繁忙