Period expressions

A period expression describes an accounting period relative to the current period of a calendar.

The most common period expression is "CURRENT" or its equivalent of an empty string "".

Period expressions consist of keywords, numeric constants, string constants, and/or codes strung together using appropriate syntax.

Note

To help you interpret the syntax models that follow, keep these things in mind:

  • Brackets "[ ]" indicate that the item enclosed is optional.
  • A vertical pipe "|" indicates "or".
  • NUMBER represents a numerical constant; it is interpreted as an Excel date number.
  • STRING represents a string constant; it is interpreted as a date in SQL Server constant date format.

There are two basic types of period expressions:

  • Current. This type of period expression has the following general syntax:

    [CURRENT] [PERIOD] [[+/-] NUMBER] [PERIOD | PERIODS | YEAR | YEARS]

    Examples

    • CURRENT
    • CURRENT PERIOD
    • CURRENT - 1
    • PERIOD 1
    • CURRENT - 1 YEAR
  • Literal. This type of period expression starts with the PERIOD keyword in conjunction with either the THROUGH keyword or the CONTAINING keyword and has the following general syntax:

    These can be condensed to the following general syntax statement:

    [PERIOD THROUGH | CONTAINING] [[NUMBER] | [STRING] | [[YEAR | PERIOD] [BEGIN | END] [CURRENT] [PERIOD] [[+/-] NUMBER] [PERIOD | PERIODS | YEAR | YEARS]]] [OF CALENDAR]

Sub-expressions

Sub-expressions can be components of larger expressions. For period expressions, there are two sub-expressions we'll consider: PERIOD NUMBER and OF CALENDAR.

  • PERIOD NUMBER. A PERIOD NUMBER sub-expression has the following general syntax:
  • PERIOD NUMBER [OF] [STRING] [OF CALENDAR] [[+/-] NUMBER] [PERIOD | PERIODS | YEAR | YEARS]

    Note

    The STRING in this syntax statement is a string constant or code that is interpreted as a year code.

    Examples

    • PERIOD 1 OF 2006
    • PERIOD 12 OF "2008"
    • PERIOD 4 OF 2008 OF Quarterly
  • OF CALENDAR. An OF CALENDAR sub-expression has the following general syntax:
  • OF STRING

    Note

    The STRING in this syntax statement is a string constant or code that is interpreted as a calendar name.

    Examples

    • PERIOD THROUGH CURRENT OF "Quarterly"
    • PERIOD CONTAINING "2014-10-15" OF Daily

Period offsets

Period offsets are additions or subtractions from the base period (typically, from CURRENT). The portion of the syntax examples cited above in red text represent the period offset. Period offsets can be used more than once (see the third example below).

A period offset has the following general syntax:

[+/-] NUMBER [PERIOD | PERIODS | YEAR | YEARS]

Examples

  • CURRENT - 1
  • CURRENT - 1 YEAR
  • CURRENT - 1 PERIOD - 1 YEAR

Note

If no period or year is specified in a period offset statement, PERIOD or PERIODS is assumed.