For selecting a range of dates in a filter shelf, let's use a visual built on the Flights Delays dataset created from data in table flights-2015-01-02.csv (compressed), and extended in Creating Joins.
Create a new field crs_dep_timestamp
directly on the dataset. It combines the
fl_date
and crs_dep_time
data into a new
timestamp field that has the following definition:
concat(substr(cast([fl_date] as string),1,11),
if(length(cast([crs_dep_time] as string))=3,
concat('0',substr(cast([crs_dep_time] as string),1,1),':',
substr(cast([crs_dep_time] as string),2,2),':00'),
concat(' ',substr(cast([crs_dep_time] as string),1,2),':',
substr(cast([crs_dep_time] as string),3,2),':00')))
Create a new cross tabulation visual on the dataset Flight Delays with the following configuration:
unique_carrier
. Alias the field as Airline
.On the Y shelf, add the dimension fl_date
.
Click the filed name, and under the Field Properties, change the Date/Time Functions to Date.
Alias the field as Date
.
dep_delay
, and ensure that it uses the
avg(dep_delay)
aggregate. Alias the field as
Delay
.crs_dep_timestamp
.Click Refresh Visual. Note that all the date values in the dataset, starting with 2015-01-01 and ending with 2015-02-28.
On the Filters shelf, click the crs_dep_timestamp
field, then click Select values.
In the Filter for crs_dep_timestamp modal window, click the Date Range tab, and click inside the textbox that contains the text click to select range.
Note the selection options in date range/calendar interface:
Pre-set ranges, such as Today, Yesterday, Last 7 Days, Last Week, Last 30 Days, This Month, and Last Month.
After clicking Refresh Visual, the updated visual appears. Note the range of dates we specified in the previous step.