Creating a Custom Calendar

The custom calendar table can be built into a cBase, or can remain a text file and be built as part of the calendar declaration. The calendar text file allows you to define custom period type columns that map any given date to user-defined periods. The source text file needs to include one row for each date where a period changes value.

The text file of dates for your custom calendar must have the following columns:

  • Date (YYYY/MM/DD)
  • Year (YYYY)

Optional columns you can include:

  • Half
  • Quarter
  • Tertile
  • Month
  • Week

The Date string is built into the calendar as data type date, while the Year string and optional columns are data type integer. A year period type is always generated, and then a period type is generated for each other integer column. For example, a calendar table with columns Date, Year, Quarter, and Month generates period types year, year-quarter, and year-month.

NOTE:

Consider the following points when constructing calendar data sets:

  • The data set should have one row per period start date.
  • The date entry on each row must be unique.

  • The data set should be sorted down on the date column before the build. Either the text file itself should be generated sorted, or a sort operation should be specified in the Build file.
  • The data set must have a row for every period you expect to use in the data, so you might want to generate some number of historical periods, and some future periods as well, and plan to regenerate the calendar periodically.

See also: