This topic describes how to add data comparison for a measure field.

Prerequisites

A line chart that contains only one date field is created. For more information about how to create a line chart, see Line chart.

Background information

The following table describes the data comparison feature for different date field types.
Date field type Example Description
Year (in the format of yyyy) report_data(year)
  • Last year: Compares data between this year and last year, such as 2021 and 2020.
  • Custom end date: Compares data between this year and a custom end year, such as 2021 and 2009.
Quarter (in the format of yyyyqq) report_data(quarter)
  • Same period last year: Compares data between this quarter and the same quarter last year, such as the first quarter of 2021 and 2020.
  • Last quarter: Compares data between this quarter and last quarter, such as the first quarter of 2021 and the fourth quarter of 2020.
  • Custom end date: Compares data between this quarter and a custom end quarter, such as the first quarter of 2021 and the third quarter of 2020.
Month (in the format of yyyymm) report_data(month)
  • Same period last year: Compares data between this month and the same month last year, such as January 2021 and January 2020.
  • Last month: Compares data between this month and last month, such as January 2021 and December 2020.
  • Custom end date: Compares data between this month and a custom end month, such as January 2021 and April 2020.
Week (in the format of yyyy-ww) report_data(week)
  • Same period last year: Compares data between this week and the same week last year, such as the second week in 2021 and the second week in 2020.
  • Last week: Compares data between this week and last week, such as the second week and the first week in 2021.
  • Custom end date: Compares data between this week and a custom end week, such as the second week in 2021 and the seventeenth week in 2020.
Day (in the format of yyyymmdd) report_data(day)
  • Same period last year: Compares data between today and the same day last year, such as January 13, 2021 and January 13, 2020.
  • Same period last month: Compares data between today and the same day last month, such as January 13, 2021 and December 13, 2020.
  • Same period last week: Compares data between today and the same day last week, such as January 13, 2021 and January 6, 2021.
  • Last day: Compares data between today and yesterday, such as January 13, 2021 and January 12, 2021.
  • Custom end date: Compares data between today and a custom end date, such as January 13, 2021 and June 21, 2021.
Hour (in the format of hh), minute (in the format of hh:mm), second (in the format of hh:mm:ss), and a date field in the format of yyyymmdd hh:mm:ss report_date(hour), report_date(minute) report_date(second), and report_date(ymdhms) Data comparison cannot be configured.
The following figure shows the data comparison result. Sample figure 312.1

Limits

  • Only line charts support the data comparison feature.
  • You can use the data comparison feature when you specify only one field for Value Axis (Mea.).
  • You can use the data comparison feature when you specify only one field for Category Axis (Dim.).
  • After the data comparison feature is enabled, you can only view the data comparison results on the mobile terminal. You cannot change the comparison items.
  • The data comparison feature is not supported if one of the following features is enabled for a line chart: circling, prediction, exception detection, and fluctuation analysis.

Example of configuring data comparison

report_date(day)

The following steps are performed on a line chart.

  1. Go to the dashboard editing page. For more information, see Create a dashboard.
  2. On the Data tab in the Chart Design section, add fields to Value Axis (Mea.) and Category Axis (Dim.).
    • In the Dimensions list, double-click or drag-and-drop the report_date(day) field to add it to Category Axis (Dim.).
    • In the Measures list, double-click or drag-and-drop the order_amt field to add it to Value Axis (Mea.).
  3. Click the Advanced tab in the Chart Design section. Configure Add data comparison in the Advanced Settings section.
    In this example, Same Period Last Year, Same Period Last Month, Same Period Last Week, The Day Before, and Custom End Date are selected for the order_amt field. Add data comparison 312.1
  4. Click the Data tab and click Update.
    Data comparison for the report date(day) field 312.1

report_date(month)

The following steps are performed in a line chart.

  1. Go to the dashboard editing page. For more information, see Create a dashboard.
  2. On the Data tab in the Chart Design section, add fields to Value Axis (Mea.) and Category Axis (Dim.).
    • In the Dimensions list, double-click or drag-and-drop the report_date(month) field to add it to Category Axis (Dim.).
    • In the Measures list, double-click or drag-and-drop the order_amt field to add it to Value Axis (Mea.).
  3. Click the Advanced tab in the Chart Design section. Configure Add data comparison in the Advanced Settings section.
    In this example, Same Period Last Year, Last Month, and Custom End Date are selected for the order_amt field. report_date(month) field 312.1
  4. Click the Data tab and click Update.
    Data comparison for the report_date(month) field 312.1

report_date(quarter)

The following steps are performed in a line chart.

  1. Go to the dashboard editing page. For more information, see Create a dashboard.
  2. On the Data tab in the Chart Design section, add fields to Value Axis (Mea.) and Category Axis (Dim.).
    • In the Dimensions list, double-click or drag the report_date(quarter) field to Category Axis (Dim.).
    • In the Measures list, double-click or drag the order_amt field to Value Axis (Mea.).
  3. Click the Advanced tab in the Chart Design section. Configure Add data comparison in the Advanced Settings section.
    In this example, Same Period Last Year, Last Quarter, and Custom End Date are selected for the order_amt field. report_date(quarter) field 312.1
  4. Click the Data tab and click Update.
    Data comparison for the report_date(quarter) field 312.1

report_date(year)

The following steps are performed in a line chart:

  1. Go to the dashboard editing page. For more information, see Create a dashboard.
  2. On the Data tab in the Chart Design section, add fields to Value Axis (Mea.) and Category Axis (Dim.).
    • In the Dimensions list, double-click or drag the report_date(year) field to Category Axis (Dim.).
    • In the Measures list, double-click or drag the order_amt field to Value Axis (Mea.).
  3. Click the Advanced tab in the Chart Design section. Configure Add data comparison in the Advanced Settings section.
    In this example, Last Year and Custom End Date are selected for the order_amt field. report_date (year) field 312.1
  4. Click the Data tab and click Update.
    Data comparison for the report_date(year) field 312.1