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.
An empty filter bar is added to the dashboard. For more information, see Create a filter bar.
Query data of a specific day
The following example shows the sales data of a specific day. The shipping_date(day) field is used in this example.
On the Dashboards page, select a dashboard. The following figure shows the chart and filter bar that are displayed on the dashboard.
In the filter bar, click Advanced configuration.
In the Query condition setting dialog box, perform the steps that are shown in the following figure to configure filters.
After the configuration is complete, select a date in the filter bar and click Inquire to view the sales data of the day.
To view data in an efficient manner, you can configure the following parameters:
Set time filter range: You can specify a time range to filter data. After you set a time filter range, you cannot select a time range that exceeds the time range.
Set the relative time range. You can configure the relative time as shown in the following figure.
NoteYou can select all the granularities included in the current time granularity from the drop-down list. If the current time granularity is year-month-day, you can select the year, month, and day from the drop-down list. If the current time granularity is year-month-day-hour-minute-second, you can select year, month, day, hour, minute, and second from the drop-down list.
For example, when the time granularity is year, month, day, hour, minute, and second, you can change the relative time of seconds. If the time granularity is only seconds, it is troublesome to calculate the number of seconds. In this case, you can switch to the day granularity to quickly view time data under different dates.
Set the exact time range.
If you select Dynamic Query Time Window and specify the Maximum Query Time parameter, you can specify the maximum query time within the specified time range.
Setting default values manually: You can set Setting Mode to Manual Input or Dynamic Function to specify default values.
You can manually set the default value for relative time or exact time. For more information, see Set a time range.
If the data of the current day or the previous day is not generated, you cannot accurately select a date by using the relative time or absolute time. In this case, you can use dynamic functions to obtain the date on which data is generated.
Switch Dates: If you select this option, a left arrow and a right arrow are displayed next to the date filter box in the filter bar to allow you to switch between dates.
NoteIf the time granularity for dates is year, quarter, month, week, or day and the Screening method parameter is set to singleday, you can use Switch Dates.
If you set Filter Method to Single Day and Enable, a shortcut arrow is added to the corresponding date widget on the dashboard. You can click the icon to quickly switch the date. The following figure shows the effect.
NoteThe left and right arrows can be used only when date values exist in the date filter bar.
If you specify a time range, you cannot click the left arrow or the right arrow to switch to a date that is out of the time range.
Query data within a specified time range
The following example shows the profit of a store within a specific period of time. The shipping_date(day) field is used in this example.
On the Dashboards page, select a dashboard. The following figure shows the chart and filter bar that are displayed on the dashboard.
The date field must be included in the dashboard chart.
In the filter bar, click Advanced configuration.
In the Query condition setting dialog box, perform the steps that are shown in the following figure to configure filters.
After the configuration is complete, select a date in the filter bar and click Inquire to view the profit of the store within the specified period of time.
If the Screening method is set to dayInterval, you can also configure parameters to view data in an efficient manner.
Interval type: allows you to select Start at, Ends at, Time interval, or Fast range.
Started at
Expiration Time
Time Interval
Shortcut Interval
Custom Shortcut Range: You can customize the value of a shortcut range in multiple scenarios.
NoteThis parameter can be configured only when the Interval type parameter is set to Fast range.
Set a chart with only the start and end time points associated: You can select this option for the specified time range to take effect for different charts on the dashboard.
After you select this option, you can specify one of the following conditions for chart association:
Limited start time
Limited End Time
Limited time interval
NoteYou can configure the Set a chart with only the start and end time points associated parameter only when the Interval type parameter is set to Time interval.
Date granularity switching
Date granularity helps you quickly view data information from different time perspectives on one dashboard page. In specific scenarios in which you want to view data at different granularities, you can configure only one filter bar without the need to use multiple dashboards or tabs.
If you use the date granularity switch, the associated date field must be a year, month, day, hour, minute, and second field (for example, order date (ymdhms)).
In the Query condition setting dialog box, perform the steps that are shown in the following figure to configure filters.
In this example, the shipping_date field is selected.
In the Basic configuration section, configure the following parameters:
Time Granularity: If you select a time granularity for the associated field, a default value is automatically added to the Time Granularity field.
If the associated field that you select is shipping_date, the default value of Time granularity is YYYYMMDD HH:MM:SS. You can also select the years, Year-quarter, Year-week, and year month day granularities from the Time granularity drop-down list based on your business requirements. You can also delete the time granularities that you do not require.
Granularity setting: After you configure different granularities, you can quickly view data at different granularities on the dashboard.
NoteYou can configure Granularity setting only when you select two or more time granularities for the Time Granularity parameter.
Set default filter value: You can select this option to specify default values for filters.
After you configure Granularity setting, you can specify different default values for each time granularity. This way, you can query data when you change the time granularity.
After the configuration is complete, change the time granularity in the filter bar, select a date, and then click Inquire.
You can also switch between time granularities to quickly query data of the related time granularity.