YEAR

Syntax

YEAR ({Date})

Description

The YEAR function returns the year of Date. If Date is omitted, the function returns the year of the calculation date.

Example

Suppose that an analytic model contains a data cube called YEAR_EXAMPLE that uses a dimension called MONTHS, and has the following formula: YEAR( ). Because the argument is omitted, YEAR returns the year for each date in the MONTHS dimension.

Now suppose that you plan to build a new building in 2006, and you want to spread the building costs over the quarters of that year. On the other hand, you do not want to allocate the building costs to any other years. If the year and building costs are stored in data cubes called BUILDING_YEAR and TOTAL_BUILDING_COSTS, you can calculate the QTRLY_BUILDING_COSTS data cube as follows:

IF(YEAR( ) = BUILDING_YEAR, TOTAL_BUILDING_COSTS / 4, 0)

Related Topics