Todate

The MDX Todate function converts date strings to numbers that can be used in Essbase calculations.

Syntax

Todate ( string_value_expression_1 ,string_value_expression_2 )

Parameters

string_value_expression_1

The format of the date string, either "mm-dd-yyyy" or "dd-mm-yyyy" (must be in lower case).

string_value_expression_2

The date string.

Notes

  • If you specify a date that is earlier than 01-01-1970, this function returns an error.

  • The latest date supported by this function is 12-31-2037.

Example

For products introduced before 06.01.1996, the following query calculates a Revised Budget that is 110% of Budget.

WITH MEMBER
 [Scenario].[Revised Budget]
AS
 'IIF (
       [Product].CurrentMember.[Intro Date] 
        > TODATE("mm-dd-yyyy","06-01-1996"),
        Budget * 1.1, Budget
      )'
SELECT
 {[Scenario].Budget, [Scenario].[Revised Budget]}
ON COLUMNS,
 [Product].[200].Children 
 DIMENSION PROPERTIES [Intro Date]
ON ROWS
FROM Sample.Basic
WHERE ([Measures].[Sales], [Year].[Qtr3])

This query returns the grid:

Table 4-132 Output Grid from MDX Example

Axis-1 Axis-1.properties Budget Revised Budget
200-10 (Intro Date = 09-27-1995, type: TIME, ) 11060 11060
200-20 (Intro Date = 07-26-1996, type: TIME, ) 9680 10648
200-30 (Intro Date = 12-10-1996, type: TIME, ) 3880 4268
200-40 (Intro Date = 12-10-1996, type: TIME, ) 2660 2926