Using Variables In Selections: Date Variables
Date variables are a special type of Selector variable that FastStats can manipulate in different ways. Date variables can be identified in the System explorer as they have a calendar icon to the left of the variable name.
To create a selection on a Date variable e.g. Booking Date:
Create a new selection either by:
a. clicking on the Selection icon in the Toolbox
b. dragging the Selection tool from the Toolbox onto the FastStats workspace
c. dragging the Date variable to use in the selection directly from the System explorer onto the FastStats workspace
If you used method a) or b) above to create a new selection, you will have a blank selection window similar to the one below.
The resolve table has been changed to Bookings
With methods a) and b):
-
Drag and drop the Date variable to use e.g. Booking Date onto the New Selection window
You then have a choice as to how you pick which dates to select. You can use dates in a similar way to other Selector variables by just picking the days to select from a list. To do this use the Type drop down list and select Ad-hoc Dates.
This will bring up the Date Range Window (below) and you can select which dates to include.
Note that the drop down box towards the top right of this window changes how the dates pick list are displayed. This can be changed to show the dates picklist as individual dates, months, years, etc. This works in the same way as other zoom or summary variables. A description of the options available can be found at Cube: How do I create a Cube with a Date Variable?
However, it may be more useful to select a set of dates by defining a rule rather than picking lots of individual days. Whilst rules can be used to select absolute date ranges as with above, they can also be used to define more complex ranges and use relative dates too.
-
Choose the A Date Range option from the Type drop down or any of the predefined date rules (such as Today, This Month, etc).
This will display the Date Rule window (below) which allows you to define the dates to be included in the rule.
The Date Rule window is split into 4 sections. The first is the Description section that allows you to change the default description to be used when listed with any other rules or list of dates (see the screenshot for the final step, below).
The second section is the Pattern section and is used to define which dates are selected. By default it is hidden and set to choose every day between the from and to dates. It can, however, be expanded to allow you to change the pattern (see below).
The third and fourth sections are the From and To sections and are used to define a range over which the pattern will work.
The Pattern section has four different displays, depending on which of the Daily/Weekly/Monthly/Yearly radio buttons are selected on the left hand side.
The From and To sections are then used to define the range over which the pattern will work.
There are a number of options available:
-
Earliest: This is the first date that the FastStats system holds.
-
Latest: This is the last date that the FastStats system holds.
-
26/01/2007: This allows you to specify an absolute date that will stay the same over time (i.e. the date 26/01/2007 will still be the same tomorrow as it is today).
-
Today Forward by 0 Days: This option allows you to specify a relative date that will change depending on the date that the selection is run. The default is for today's date, but you can change the combo box to be one of:
Today
This Week
This Month
The Year
Load Date
Load Week
Load Month
Load Year
First Populated Date
First Populated Week
First Populated Month
First Populated Year
Last Populated Date
Last Populated Week
Last Populated Month
Last Populated Year
Note that for the From range the date chosen will be at the start of the period (i.e. the Monday of the week, the 1st of the month or the 1st of January of the year). The To range uses the end of the period (i.e. the Sunday of the week, the last day - 28th, 29th, 30th or 31st, depending - of the month or the 31st December of the year).
The To range also supports the following options:
-
Forward by 10 occurrences.
-
Backward by 10 occurrences.
This allows you to pick the first n times the pattern occurs. This might be from start date for 10 days, from the start date for 10 weekend days or from the start date for 10 2nds of every month.
Finally, when you are happy with your date rule or selected date values, select OK and the rule or values will be inserted into the list (as below). You can then:
-
rename the item to have a more meaningful name
-
create more rules or date values by pressing the buttons on the bottom toolbar again
You can also delete the items already created by right-clicking the row in the list and selecting Delete.
Return to Using Variables in Selections