This topic describes how to configure a filter bar to query data based on a date field.

Prerequisites

  • A dashboard that contains date fields is created.
  • A filter bar is created on the dashboard. For more information, see Create a filter bar.

Query the number of orders that are generated in a specific month

  1. Choose Workspace > Dashboards.
  2. On the Dashboards page, select the created dashboard. The dashboard contains the chart and filter bar shown in the following figure.
    The chart must contain date fields. 311
  3. In the Set Query Conditions dialog box, configure the filter bar.
    The following example shows the configurations of a filter bar in which the time granularity is set to month.
    1. In the Query Conditions section, set the query condition name to Monthly Query.
    2. In the Associated Charts and Fields section, select Line Chart-month and then select report_date(month) from the drop-down list to the right of Line Chart-month.
      3
      Note The console automatically selects a time granularity in the Basic Configuration section after you select an associated field. For example, if you select report_date(month) from the drop-down list in the Associated Charts and Fields pane, Granularity in the Basic Configuration section is automatically set to Year-Month.
    3. In the Basic Configuration section, configure Display Type, Granularity, Set Time Range, Filter By, Interval Type, and Set Filter Defaults.
      • Set Time Range: You can specify a time range to filter data generated within this time range.
        After you specify a time range, the date that you select in the filter bar in the dashboard display section must be within the specified time range. If you select Dynamic Query Time Window, you can specify a maximum time period during which data can be queried. Set Time Range
      • Filter By: You can select Single Month or Month Interval.

        To switch between dates with one click in the filter bar, you can select Switch Dates when Granularity is set to Year, Year-Quarter, Year-Month, Year-Week, or Year-Month-Day and Filter By is set to Single Day.

        • If you set Filter By to Single Month and select Switch Dates, you can click the backward or forward arrow in the filter bar to switch between dates. The following figure shows an example. Alibaba Cloud international site (alibabacloud.com) 3.12.2
          Note
          • The backward and forward arrows take effect only when the selected date field has valid values.
          • If you have specified a time range but the date you selected in the filter bar is later than the specified time range, the forward arrow does not take effect
        • In the following figure, Filter By is set to Month Interval and Interval Type is set to Time Interval. Month Interval
      • Interval Type: If you set Filter By to Month Interval, you can set Interval Type to Start At, End At, Time Interval, or Quick Range.
        For example, you can set Filter By to Month Interval and set Interval Type to Quick Range for a monthly query. This way, you can customize a time range. Quick Range
        After you save the configurations, you can select the configured quick time range or select Customize from the drop-down list of the filter bar. When you select Customize, you can manually specify a time range. Quick Range
      • Set Filter Defaults: Default filter values can be displayed only after you specify this parameter.
  4. Click OK.
  5. In the filter bar, specify the time range in which you want to query data and click Inquire. The chart to which the filter bar applies is updated.
    month

Query the number of orders that are generated at a specific time

  1. On the Dashboards page, select the created dashboard. The dashboard contains the chart and filter bar shown in the following figure.
    The chart that is created in the dashboard must contain date fields. Precise time
  2. In the Set Query Conditions dialog box, configure the filter bar.
    The following example shows the configurations of a filter in which the time granularity is set to Year-Month-Day-Hour-Minute-Second.
    1. In the Query Conditions section, set the query condition name to Year-Month-Day-Hour-Minute-Second.
    2. In the Associated Charts and Fields section, select Line Chart-ymdhms and then select report_date(ymdhms) from the drop-down list to the right of Line Chart-ymdhms.
      311

      You can set the date format on the dataset editing page. For more information, see Edit dimensions and measures.

      Valid values:
      • yyyyMMdd HH:mm:ss
      • yyyy-MM-dd HH:mm:ss: This is the default value.
      • yyyy/MM/dd HH:mm:ss
      This setting takes effect only on the date displayed in the filter bar. The date format in the data source is not affected. For example, if you set Date Display Format to YYYY/MM/DD HH:mm:ss, the date format in the filter bar is the same as that in the following figure. 1
    3. In the Basic Configuration section, configure Display Type, Granularity, Set Time Range, Filter By, Interval Type, and Set Filter Defaults
      • Set Time Range: You can specify a time range to filter data generated within this time range. After you specify a time range, the date that you select in the filter bar in the dashboard display section must be within the specified time range. The following figure shows how to set year, month, day, hour, minute, and second.
        Click the calendar icon and select year, month, and day. Year-Month-Day
        Click Select Time to select hour, minute, and second. Set Time Range
        Note If you want to reset year, month, and day, click Select Date.
      • Filter By: You can select Single Second or Second Interval.
        In the following figure, Filter By is set to Second Interval and Interval Type is set to Time Interval. 123
      • Interval Type: If you set Filter By to Second Interval, you can set Interval Type to Start At, End At, or Time Interval.
      • Set Filter Defaults: Default filter values are displayed in the filter bar only after you specify this parameter.
  3. Click OK.
  4. In the filter bar, specify the time range from which you want to query data and click Inquire. The chart to which the filter bar applies is updated.
    5