Wednesday, November 19, 2014

Hyperion Planning - Date Function

Hyperion Planning has the ability to input data in "Date" format, but actually the data store in Essbase is still a number with the format "YYYYMMDD", not a real date type of data. In a real case, a client wants to calculate the interval days between two given days input in Hyperion Planning. I searched some blogs to introduce using CDF to calculate the difference, but I am not good at CDF and I tried to calculate it with the following basic functions.
  • @TODAY
Please find the code as below,

The calculation logic is as below,

1. "Start Date", "End Date" are the dates input in Hyperion Planning, and they are stored in Essbase with "YYYYMMDD" format as numbers. To explain more easily, we assume
  • sDate = "Start Date" = 20130101
  • eDate = "End Date" = 20141120

2. Then we need to breakdown the date into its elements (Year, Month and Day), with the calculation above, we can calculate
  • sYear = 2013
  • sMonth = 1
  • sDay = 1
  • eYear = 2014
  • eMonth = 11
  • eDay = 20

3. Next step, we will translate the "Start Date" and "End Date" from number format to a date format with @DATAROLL function. The logic is, we set a start date 2000-01-01, and then roll the number of years (sYear - 2000), number of months (sMonth - 1) and number of days (sDay - 1) as the intervals. So that we can get the following result,
  • StartDate = 2013-01-01 (Date format)
  • EndDate = 2014-11-20 (Date format)

4. Last step, we just need to use @DATADIFF function to calculate the difference of two dates (StartDate and EndDate)
  • nDay = 689

Another use case is, if we want to get the number of year, month and days of the month for the current point of view. For example, if the POV is FY14, Nov, it need to return three numbers 2014, 11 and 30.

Let's create three dynamic members: nYear, nMonth and nDay. The member formulas are as below, (Assume the Planning application start year is FY05)

  • nYear

  • nMonth
IF (@ISMBR("Jan"))

  • nDay
IF (@ISMBR("Jan","Mar","May","Jul","Aug","Oct","Dec"))
 IF ("nYear"/4 == @INT("nYear"/4))
ELSEIF (@ISMBR("Apr","Jun","Sep","Nov"))

The result is as below,

No comments:

Post a Comment