Creating relative date filters
A relative date filter specifies a range of dates that are relative to the _as_of_date global parameter.
The sample Gregorian and Fiscal calendars already contain a number of predefined relative date filters. If you need custom filters, you can add them to these calendars.
Before you begin
- Know the columns in the sample calendar.
New filters are added to the sample Gregorian or Fiscal calendar data modules. To understand how these calendars are structured, look at the columns, and view dates in different columns in the same row. For example, in the Gregorian calendar data module, for the column TheDate with the value of September 30, 2018, the related values for columns dYear, PY_TheDate, and dMonth are shown in the following table:
TheDate dYear PY_TheDate dMonth 2018-09-30 2018-01-01 2017-09-30 2018-09-01 For more information, see Sample calendars.
- Conceptualize the filter lower bound and upper bound in relation to the
_as_of_date global parameter.
A relative date filter defines a range of dates between the filter lower bound (range start) and upper bound (range end) dates. The lower and upper bounds are set against a reference date that is the _as_of_date parameter value.
For example, for a year-to-date (YTD) filter, the lower bound date is the first day of the first month in the year that contains the _as_of_date date. The upper bound date is the date that is the _as_of_date parameter value. If the _as_of_date parameter is December 19, 2018 (TheDate), the lower bound date is January 1, 2018, and the upper bound date is December 19, 2018.
By default, the _as_of_date parameter has a value of today. However, it can be set to a different date. For more information, see Customizing the reference date
- Build the filter expression.
The critical element of creating a relative date filter is the filter expression. Familiarize yourself with the expression syntax and variables before you start entering the code in the expression editor. For more information, see Creating filter expressions.