You are on page 1of 97

HFM

Hyperion Financial Management (HFM)


Rule Building

2009 IBM Corporation

HFM

Objectives
This training module intends to cover :
Recap HFM Dimensional Concepts
Overview of HFM Rules
Types of Rule
Basics of HFM Rule writing Syntax

Basics of VB Scripting
Best Practices in Rule Writing
Important rules like Calculation, Translation and
Consolidation
Examples of HFM rule writing ( Business Cases)

*Prerequisites : Basic Knowledge of HFM


2

Jun 22, 2015

2008 IBM Corporation

HFM

Summary Slide
HFM Dimensional Recap
Rules Overview
Constants and Variables
Objects and Functions
Rules Expression
Conditional Statements
Sub Procedures and Functions
Use of Loops
Movement of Balance Sheet
Translation Rules
Consolidation Rules

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Introduction

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Dimensions
Scenario
Intercompany
Partner

Year

Eight Standard
Account

Period

Dimensions

Value

View
Entity

Custom1

Four Custom
Dimensions

Custom2
Custom3
Custom4

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Task Flow

Calculate data
Load and
add data

Run and publish


financial reports

Adjust data
Translate
& Consolidate

Lock data

Approve data

Jun 22, 2015

2008 IBM Corporation

HFM

Rules Overview

Jun 22, 2015

2008 IBM Corporation

HFM

Rules- The Need

Calculations

Hierarchical Aggregation is in built functionality - Rules not needed


Powerful Customized calculations ( Ratios, variances, etc) - Rules Needed

Translations ( Currency Conversion)

Closing rates & Average rates Rules not needed


Complex conversions ( Exchange rate differences, historical rates) Rules needed

Allocations
Simple and Complex Allocations - Rules Needed

Data Entry
Data Entry Restriction at a Base Entity Level Rules needed
Data Entry in a Parent Entity Rules Needed

Custom Consolidations Rules Needed

Rules help in tuning HFM to the business requirements


Rules are the heart of the applications

Jun 22, 2015

2008 IBM Corporation

HFM

Types of Rules
Calculation

Transactions

Dynamic
Calculations

Translation

HFM
Rules

Input

Allocation

Consolidation

No Input

Jun 22, 2015

2008 IBM Corporation

HFM

Calculation Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Calculations scripts are written to perform customized calculations


Calculations which are not aggregated through natural hierarchies

Used to derive ratios or opening balances


Also used for
Clearing variables and values from accounts
Perform ad hoc calculations

10

Jun 22, 2015

2008 IBM Corporation

HFM

Translation Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Translation rules are used to perform calculations used in complex


translations
Translations requiring historical rates

Applying specific rates to specific accounts


Specific rates to calculate translation difference related to Net Revenue

11

Jun 22, 2015

2008 IBM Corporation

HFM

Allocation Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Simple and complex allocations


Allocate data from one entity to another
Single Source to multiple destinations

Example Parent Entity X has SGA ( Selling, General & Administrative


Expenses) of 100$
- Child entities A, B and C
- Allocation rule distributes the 100$ as per the business requirements amongst A,
B and C
- SGA of A 50$
- SGA of B 30$
- SGA of C 20$

12

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Consolidation Process involves entering Currency rates, percent


consolidations and ownership information

Standard and Non Standard Consolidations


Standard Consolidations Consolidation by natural aggregation of hierarchy
Default consolidation process

Non Standard Consolidation


Statutory requirements usually are Non Standard Consolidation

Consolidation rules are only active when the application setting for
ConsolidationRules is enabled. It is thought that custom consolidation rules
will be required

13

Jun 22, 2015

2008 IBM Corporation

HFM

Input Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Input rules enables the data to be entered at the Parent Entity level

By default Data cannot be entered at Parent Entity

Only the <Entity Currency> value dimension is supported for the Input Rules
For the Adjustments Value Dimension, only the journal data can be entered.
The rest of the value dimension members are rolled up.

14

Jun 22, 2015

2008 IBM Corporation

HFM

No Input Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

No Input rules prevent the data to be entered at the Base Entity Level.
By default the data can be entered at lowest level intersection for the Base
Entity

No Input rules are needed


Statutory requirements
Prohibit data entry to enable specific calculations

15

Jun 22, 2015

2008 IBM Corporation

HFM

Dynamic Calculation Rules


Calculation

16

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Dynamic Calculations are used to create/define formulas which are


dynamically executed

Dynamic Values are not stored members

Dynamic Calculations can be performed only on the base accounts. The


dynamic calculations cannot be used on the parent accounts

Jun 22, 2015

2008 IBM Corporation

HFM

Transaction Rules
Calculation

Translation

Allocation

Consolidation

Input

No Input

Dynamic
Calculations

Transactions

Transaction Rules are valid for the ICT module in HFM

Can be executed on accounts and scenarios which supports the Intercompany


transactions

17

Jun 22, 2015

2008 IBM Corporation

HFM

Triggers for the Rules Execution


Calculation

Calculation Rule is executed when Calculation or Consolidation is run

Translation

Translation Rule is executed when Translate or Consolidation is run

Allocation

18

Allocation Rule is executed when the User clicks Allocation

Consolidation

Consolidation Rule is executed when the data is consolidated

Input

Input Rules are executed when the application is opened

No Input

No Input Rules are executed when the application is opened

Dynamic
Calculations

Dynamic Calculations are executed when Calculation or Consolidation is run. All


statements in the Sub Dynamic section are executed sequentially.

Transactions

Transactions Rules are applicable for the Intercompany transaction module

Jun 22, 2015

2008 IBM Corporation

HFM

How is the Rule File Organized?


The eight types of rules are placed in
separate Sub Procedures
Sub Procedure
Series of VB Script Statements enclosed
by Sub and End Sub statements
Sub procedure performs an action but
does not return a value

Sub Calculate()
<All calculate rules are displayed here.>
End Sub
Sub Dynamic()
<All dynamic rules are displayed here.>
End Sub
Sub Translate()
<All translate rules are displayed here.>
End Sub
Sub Allocate()
<All allocation rules are displayed here.>
End Sub

Example
Sub Calculate ( )
<< Vb Script Statements>>
End Sub

Sub NoInput()
<All no input rules are displayed here.>
End Sub
Sub Consolidate()
<All consolidate rules are displayed here.>
End Sub

Rules files can have constants defined at


the beginning of the rule file

Sub Input
<All input rules are displayed here.>
End Sub
Sub Transactions()
<All transactions rules are displayed here.>
End Sub

19

Jun 22, 2015

2008 IBM Corporation

HFM

Characters Used to Specify Dimensions in Rule


Expressions

20

Jun 22, 2015

2008 IBM Corporation

HFM

Constants and Variables

21

Jun 22, 2015

2008 IBM Corporation

HFM

Constants

Constants are defined at the beginning of the rule file


Constants are assigned values which cannot be changed.
They can be used throughout the rule file in all the sub
procedures
If constants are declared within a procedure, they are
available only for that procedure
E.g. const PRIOR_YEAR_RATE=75

22

Jun 22, 2015

2008 IBM Corporation

HFM

Example Use of Constants


Case : Transferring the Retained Profit/Net Income from P&L into
Balance Sheet
Metadata
A140000_C Balance Sheet Account ( Destination Account)
NetIncome ACustom 2 (base member)
PT950 P&L Account (Source Account)
C1, C2 , C3 & ICP (Source) Top Level
C1, C2 , C3 & ICP (Destination) [None]
Requirement :
Transfer the amount in PT950 with Customs and ICP at Top Level to account
A140000_C at the intersection of Custom2.NetIncome and Custom1,3 & 4 and ICP at
None level.

* Reference: Astellas Rule file

23

Jun 22, 2015

2008 IBM Corporation

HFM

Example Use of Constants (contd)

Expression - Without use of Constants


HS.Exp "A#A140000_C.C2#NetIncome. C1#[None].C3#[None].I#[ICP None].
W#YTD=
A#PT950.C1#AllCustom1.C2#AllCustom2.C3#AllCustom3.C4#AllCustom4.I#[ICP
Top]. W#YTD

Expression - With use of Constants


Define Constants at the beginning of the Rule File
Const cAllNonesXC2XC4 = "C1#[None].C3#[None].I#[ICP None]
Const cAllTopsXC4 = "C1#AllCustom1.C2#AllCustom2.C3#AllCustom3.I#[ICP Top]

Simplified Expression
HS.Exp "A#A140000_C.C2#NetIncome." & cAllNonesXC2XC4 & ".W#YTD =
A#PT950." & cAllTopsXC4 & ".W#YTD
* Reference: Astellas Rule file

24

Jun 22, 2015

2008 IBM Corporation

HFM

Variables
Variables are temporary placeholders used in VB Scripts
Increases performance and makes the code less complex
Variables can be used only in the Sub procedure in which they
are created.
Can be declared on the fly
Declared explicitly using Dim Statements

25

Must begin with alphabetic character


Cannot exceed 255 characters
e.g. Dim vAcc1
Use of the syntax Option Explicit enforces the use of explicit
declaration of the variable

Jun 22, 2015

2008 IBM Corporation

HFM

Example Use of Variables


Examples of Using Dim Statements for Defining Variables
Dim vPOVScenario, vPOVEntity, vPOVValue, vPOVYear,
vPOVPeriod, vPOVPeriodNumber, vPOVView,
vPOVDefCurrency, vPOVFreq
Current Point of View
Hs.<Dimension>.Member Holds the member of the corresponding
dimension in the Current POV

Variables can be used to hold the members in the current POV

26

vPOVScenario = HS.Scenario.Member()
vPOVEntity = HS.Entity.Member()
vPOVValue = HS.Value.Member()
vPOVYear = HS.Year.Member()
vPOVPeriod = HS.Period.Member()
vPOVPeriodNumber = HS.Period.Number()
vPOVView = HS.Scenario.DefaultView("")
vPOVDefCurrency = HS.Entity.DefCurrency("")
vPOVFreq = HS.Scenario.DefaultFreq("")

Jun 22, 2015

The current POV


members are stored
in the variables

The attributes of the


dimensions are
stored in the variable

2008 IBM Corporation

HFM

Objects and Functions

27

Jun 22, 2015

2008 IBM Corporation

HFM

Objects and Functions


Hs.Object.Function
Objects can be the dimensions in HFM
Rules are written by applying functions to the Objects.
HS is the top level object in HFM.
Functions are actions performed for that objects. Objects can have their
own set of functions
Top Level Object
Object
Function

e.g. Hs.Account.IsICP
The above syntax retrieves the value True or False depending on the fact that the
Account is marked ICP or not

Dots are used to separate the objects from other objects or functions

28

Jun 22, 2015

2008 IBM Corporation

HFM

Functions of HS
ABSExp

Executes a calculation expression and stores the result as an absolute value

Alloc

Allocates data to the cell

CalcStatus

Gets the calculation status of the cell

Clear

Clears the data from the cell

Con

Multiplies the data with a factor and put the data into [Elimination] or [Proportion]

Exp

Executes a expression and puts data into destination POV from Source POV

Dynamic

Used for performing calculation of Dynamic Accounts

GetCell

Gets the data from a cell

GetCellNoData

Gets the data from the cell and indicates if there is no data

GetCellRealData

Gets the data from the cell and indicates if there is real data

Input

Enables input at parent entity level

NoInput

Prevents input into the cells

ContainsCellText

Determines if the cell contains Cell Text

OpenDataUnit

Gets the data unit for consolidation

SetData

Sets data for a valid intersection

Trans

Translates Currency using Year to date method

TransPeriodic

Translates currency using Periodic method

*P.S. This slide does not represent the complete set of Functions

29

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Dimensional Functions


Account
AccountType

Returns the account type for the member

C1...4 Top

Gets the Custom Top Member for the account member

IsBase

Determines if the member specified is a base member

IsCalculated

Determines if the account member is a calculated account

IsChild

Determines if the current member is a child of another member

IsConsolidated

Determines if the current member is a consolidated account

IsDescendant

Determines if the current member is a descendant of another member

IsICP

Determines if the current member is a Intercomany account

List

Gets the elements contained in a list

NumBase

Gets the number of Base members

NumChild

Gets the number of the children for the member

PlugAccount

Gets the plug account of the member

UD1...3

Gets the user defined attribute(UD1 or UD2 or UD3) of the Account

ValidationAccount

Gets the validation account

*P.S. This slide does not represent the complete set of Functions

30

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Dimensional Functions (Contd)


Entity
AllowAdjs

Determines if journal postings are allowed for the entity member

AllowAdjsFromChildre
n

Determines if the journal postings are allowed from children for the member

DefCurrency

Gets the default currency of the entity

Holding

Determines if the entity member is a holding member

IsBase

Determines if the entity member is a base member

IsChild

Determines if the member is a child of another entity member

IsDescendant

Determines if the entity is a descendant of another entity member

IsICP

Determines if the entity member is a Intercompany member

SecurityAsPartner

Gets the security class for the ICP Entity

SecurityClass

Gets the security class for the member

UD1...3

Gets the User Defined attribute for the Entity

*P.S. This slide does not represent the complete set of Functions

31

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Dimensional Functions (Contd)


Scenario
ConsolidateYTD

Determines if the Scenario member is consolidated Year to Date

DefaultFreq

Gets the Default Frequency of the current scenario member

DefaultView

Gets the default View of the current scenario Member

Period
IsFirst

Gets the First Member of the Period

IsLast

Gets the last member of the Period

Number

Gets the number of the current period

Custom1..4
SwitchSign

Determines if the debit/credit sign are reversed for a specified custom member

SwitchType

Determines if the account types are switched for a specified custom member

*P.S. This slide does not represent the complete set of Functions

32

Jun 22, 2015

2008 IBM Corporation

HFM

Common Functions across Dimensions


IsBase
IsChild
IsDescendant
NumChild
NumDescendant

Entity Dimension
Common Across

Custom Dimensions,
Account Dimensions

Entity
List
SecurityClass

Account
Common Across

Custom
Scenario

IsICP

Common Across

Account
Entity

*P.S. This slide does not represent the complete set of Functions

33

Jun 22, 2015

2008 IBM Corporation

HFM

Hs.OpenDataUnit Function
Data Units are all the intersections which have data for a given POV
Function HS.OpenDataUnit is used to open the set of intersections
which have data
The HS.OpenDataUnit functions can call the data set for Account,
Customs and ICP dimension
The dimensions omitted in the syntax would be included in the data set
for all the base members
e.g. HS.OpenDataUnit (A#Sales)
This would open the data set for all the intersections for which the
Account Sales has data. The omitted dimensions of Custom and
ICP would be included for all base members in the above example.

34

Jun 22, 2015

2008 IBM Corporation

HFM

Syntax of HS.OpenDataUnit
Set Command is used to open the data unit
Set MyDataUnit = HS.OpenDataUnit("S#Actual.A#Returns.Y#Prior") //OpenDataUnit
function is used to get all the data for Returns Account member for prior year for the
Actual Scenario
LNumItems = MyDataUnit.GetNumItems //GetNumItems function is used to fetch the
number of records (count) in the variable LNumItems
For i=0 to LNumItems 1 // Start of For loop
Call MyDataUnit.GetItem(i, vAcc, vICP, vC1, vC2, vC3,vC4,vData) //Intersection is
retrieved and i is used as an index. The dimensions members and the data are stored in
the variables (vAcc,vICP,.)
IF HS.Custom1.UD1(vC1) = 123 Then // For the given intersection, checks the UD1 of
custom1 member
HS.Exp A#Returns.C2# &vC2& .C3# &vC3& = &vData& *1.10 //Calculation
End If //End of If Statement
Next // End of For loop

35

Jun 22, 2015

2008 IBM Corporation

HFM

Rules Expression

36

Jun 22, 2015

2008 IBM Corporation

HFM

Rule Expression
EXP Function
EXP function is used to insert data from one account into another
account
EXPs argument contains the account to be set and the account
from which the value is retrieved
Hs.Exp Destination = Source
The destination account in the LHS is assigned the value of
the source in RHS
Example of Hs.Exp
HS.Exp "A#Sales = A#Units * A#Price"
*LHS Left Hand Side
*RHS Right Hand Side

37

Jun 22, 2015

2008 IBM Corporation

HFM

LHS and RHS Combinations

Behavior of Hs.Exp when Account Dimension, ICP Dimension


and Custom Dimensions
A. Case 1 Omitted from both sides of the equal sign
B. Case 2 Specified on the left side of the equal sign only
C. Case 3 Specified on the right of the equal sign only

*LHS Left Hand Side


*RHS Right Hand Side

38

Jun 22, 2015

2008 IBM Corporation

HFM

Case 1 - LHS and RHS Combination


HS.Exp A#GrossSales = A#GrossSales.P#Prior * 1.1
(Customs & ICP is omitted from both sides)

*LHS Left Hand Side


*RHS Right Hand Side

39

Jun 22, 2015

2008 IBM Corporation

HFM

Case 2 - LHS and RHS Combination


Specifying in the LHS
HS.Exp A#GrossSales.C2#Steel = A#GrossSales.P#Prior * 1.1
(C2 is specified in the destination, but not in source)

*LHS Left Hand Side


*RHS Right Hand Side

40

Jun 22, 2015

2008 IBM Corporation

HFM

Case 3 - LHS and RHS Combination


Specifying in RHS
HS.Exp A#GrossSales=A#GrossSales.C2#Steel.P#Prior*1.1
(C2 is specified in the source, but not in destination)

(As C2 was not specified


in LHS)
*LHS Left Hand Side
*RHS Right Hand Side

41

Jun 22, 2015

2008 IBM Corporation

HFM

Period and Year Keywords

Cur Current Period or Year


First First period or year valid for the application
Last First period or year valid for the application
Next Period or Year that follows the current year
PriorPeriod or Year that precedes the current year

42

Jun 22, 2015

2008 IBM Corporation

HFM

Adding Comments

Helps in the documentation of the rules which helps in the


understanding the purpose and interpretation of the rules
Text preceded with an apostrophe () is interpreted as a comment
E.g. 'Opening Balance Differences

43

Jun 22, 2015

2008 IBM Corporation

HFM

Conditional Statements

44

Jun 22, 2015

2008 IBM Corporation

HFM

If Then Else Statement


Most used conditional statement
Code in the THEN statement is executed only when the IF
condition is met, else the code in the ELSE is executed
If HS.Scenario.Member = "Budget" Then
HS.EXP "A#Sales = A#UnitsSold * A#Price"
End If

More than one condition


If HS.Scenario.Member = "Budget" Then
HS.EXP "A#Sales = A#UnitsSold * A#Price"
ElseIf HS.Scenario.Member = "Actual" Then
HS.EXP "A#Price = A#Sales / A#UnitsSold"
Else
HS.EXP "A#Sales = A#Sales.P#Prior * 1.1"
End If

If Scenario = Budget Then


Execution of Rule1
If Scenario = Actual Then
Execution of Rule2
If Scenario <> Actual or Budget Then
Execution of Rule3

45

Jun 22, 2015

2008 IBM Corporation

HFM

Nested If Then Else Statement

The THEN part and the


ELSE part, if required, can
contain one or more IFTHEN-ELSE Statements.

46

Jun 22, 2015

2008 IBM Corporation

HFM

Select Case Statement


A Select Case structure works with a single test expression that is
evaluated once, at the top of the structure.
The result of the expression is then compared with the values for
each Case in the structure.
Select case Hs.Period.Member
Case February

//Test Expression

// Comparison of Test Expression with the Case Defined

Hs.Exp A#MonthTotal = A#Dailytotal*28 // Execution if case matches


Case April, June, September, November // Comparison of Test Expression with the
Case Defined
Hs.Exp A#MonthTotal = A#Dailytotal*30 //Execution
Case Else

// Comparison of Test Expression with the Case Defined

Hs.Exp A#MonthTotal = A#Dailytotal*31 // Execution


End Select

47

// End of Select Statement

Jun 22, 2015

2008 IBM Corporation

HFM

Sub Procedures and Functions

48

Jun 22, 2015

2008 IBM Corporation

HFM

Sub Procedures
Organizes the rule file into logical sub programs
Reduces the complexity of rule file
Helps in troubleshooting
Sub routines can be called multiple times
Sub Calculate

...
Call Opening Balance()

End Sub
Sub Opening Balance ()

End Sub

49

Jun 22, 2015

2008 IBM Corporation

HFM

Calling Sub Procedures


Sub Calculate()
WholeSaleVolume = 50

// Variable declared and Value is 50

Call PerUnit_Exp_Calc("A#Manuf_Cost_Per_Unit",WholeSaleVolume) //Calling Sub procedure PerUnit_exp_Calc


End Sub

//End of Calculation Routine

Sub PerUnit_Exp_Calc(PerUnitCost,WSVolume)

//Sub Procedure PerUnit_Exp_Calc

HS.Exp PerUnitCost &"= A#TotalManufacturingCost /"&WSVolume //Calculation of Per Unit Cost


End Sub

//End of Sub Procedure

Values can be passed from Calling Procedure to the Sub Procudure


Values passed as literal text strings should be enclosed in the quotation marks, whereas numeric
values or variables do not require quotation marks
Variables can be passed by reference or by value
By Reference:- If the called procedure changes the value of the variable, the value of the variable
gets changed in the calling procedure as well. By default, variables are passed by reference
By Value:- If the called procedure changes the value of the variable, the value of the variable is
not changed in the calling procedure. The variables must be enclosed in the parenthesis.
e.g. Sub Proc_Calc((Acct), Rate)

50

Jun 22, 2015

2008 IBM Corporation

HFM

Use of Functions
Sub Procedures may or may not return values to the calling procedure.
Procedures can return multiple values.
Functions can return only one value as result, of the operation
(mathematical or logical) it performs, to the calling procedure.
Sub Calculate()

// Calculate routine

HS.EXP "A#Manuf)_Cost_per_unit =" &PerUnit_Calc(50) //PerUnit_Calc Function is called


End Sub

// End of Calculate routine

Function PerUnit_Calc(WSVolume)

// Function PerUnit_Calc

PerUnit_Calc=HS.GetCell("A#TotalManufacturingCost") // WSVolume //Operation returning


single value
End Function

51

//End of Function

Jun 22, 2015

2008 IBM Corporation

HFM

Use of Loops

52

Jun 22, 2015

2008 IBM Corporation

HFM

For Next Loop


Looping enables execution of a block of statements a specific number of
times
A counter is used , whose value is incremented or decremented with
each repetition of the loop.
Syntax

For Counter = 1 to 10
..
Block of Statements
.
Next

Example:
For vPer = 0 to 11
NetAggrCOS = NetAggrCOS + HS.GetCell("A#CostOfSales.W#Periodic.P#Cur-"&vPer)

vPer = vPer + 1
Next

53

Jun 22, 2015

2008 IBM Corporation

HFM

Do While Loop
This loop is executed till the condition is met.
Condition is given using the While Syntax.
Syntax
Do While Condition
...
...
Loop
Example
The statements inside the loop run while the value of myNum is 10 or less.
myNum = 0
Do While myNum < 11
myNum = myNum + 1
Loop

54

Jun 22, 2015

2008 IBM Corporation

HFM

Looping - Business Cases


Business Case 1

Rule Requirement:
Identify the accounts which have closing balances based on UD1 (User
Defined Attribute)
Copy the calculated closing balance from ClosingCalc(C2 Dimension) to a
member called Closing(C2 Dimension)

* Reference: Astellas Rule file

55

Jun 22, 2015

2008 IBM Corporation

HFM

Looping - Business Cases


Business Case 1 - Algorithm Logic

Identify the Accounts having closing balances. (Member List**


for Accounts having closing balances)
For each Account which has Closing Balance
Clear the existing data in the destination intersection
Copy the data from ClosingCalc to Closing for the accounts

Go to the next Account in the list

Reference: Astellas Rule file


** Member List is a User Defined list or a system defined list of some members of a dimension

56

Jun 22, 2015

2008 IBM Corporation

HFM

Looping - Business Cases


Business Case 1 - WorkFlow
Define Variable vAccount, vAccountsList
Store the member list in the Variable vAccountLists

Go to Next Account

Call Each Account in the List


Clear the data
Copy the data from ClosingCalc to the intersection
of Closing for each account in the list
Go To Next Account of the List

Last

Account?

End

* Reference: Astellas Rule file

57

Jun 22, 2015

2008 IBM Corporation

HFM

Looping - Business Cases


Business Case 1 - HFM Rule
'*******************************************************************
' () Copy Calculated Closing

//Explanation of the Sub routine using comments

'

Uses member list 'Closing Is Calculated' which is built from

'

accounts with a UD1 field of CALC_CLOSING

'*******************************************************************
Sub CopyCalculatedClosing()
Dim vAccount, vAccountsList

//Start of the Sub routine


//Declaration of variables

' Uses dynamic member list which reads UD1 attribute and checks for CALC_CLOSING string
vAccountsList = HS.Account.List("", "Closing Is Calculated)
For Each vAccount In vAccountsList

//Use of variables

// Use of For Loop

HS.Clear "A#" & vAccount & ".C2#Closing //Clearing data


HS.Exp "A#" & vAccount & ".C2#Closing = A#" & vAccount & ".C2#ClosingCalc
// Copying from Closing Calc to closing
Next

//Loop End

End Sub //End of Sub Routine


'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
' END - Copy Calculated Closing

//End of Program

'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

* Reference: Astellas Rule file

58

Jun 22, 2015

2008 IBM Corporation

HFM

Looping - Business Cases


Business Case 2

Rule Requirement:
To bring forward the Opening Balances
Calculate the current opening balances from prior year end
Calculate the opening balance from prior period closing.

* Reference: Astellas Rule file

59

Jun 22, 2015

2008 IBM Corporation

HFM

Looping - Business Cases


Business Case 2 - Algorithm Logic
Identify the Balance Sheet Accounts of which the opening balances have
to be calculated
For some balance sheet items the opening balance of all periods is
derived from the last period of the previous year**
For calculation of the Opening balance from the prior period closing
If the current period is the first period of the current month then the
closing balance of the last period of prior year is carried forward
If the current period is not the first period then the closing balance of
the previous period of the same is carried forward

Reference: Astellas Rule file


** Specific to Astelllas

60

Jun 22, 2015

2008 IBM Corporation

HFM

WorkFlow
N

Carry forward the closing balances


of the last period of the prior year

Is year
the first
year of
the
applicatio
n?

Y
No Calculation

Carry forward the closing balances of the


prior period of the current year

Is
period
the first
period
of the
year?

For Selected BS
Items for which the
opening Balances
are derived from the
last period of prior
year

For opening
Balances derived
from prior period.

Y
Carry forward the closing
balances of the last period of the
prior year

* Reference: Astellas Rule file

61

Jun 22, 2015

2008 IBM Corporation

HFM

HFM Rule
'*******************************************************************
' () Bring Forward Opening Balances //Explanation of Calculation using Comments
'

Calculates current opening balances from prior year end

'

closing and prior period closing

'*******************************************************************
If HS.Year.IsFirst() = False Then

//Start of IF Statement

// Transfer of prior year and prior period closing balances to current opening balances
HS.Exp "C2#OpeningYr = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT

//Calculation

HS.Exp "C2#OpeningCommStck = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT //Calculation


HS.Exp "C2#OpeningAddPaidCap = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT" //Calculation
HS.Exp "C2#OpeningRetEarn = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT" //Calculation
HS.Exp "C2#OpeningInvestSub = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT //Calculation
If HS.Period.IsFirst() = True Then

//Nested If Condition

HS.Exp "C2#OpeningMth = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT"


Else
HS.Exp "C2#OpeningMth = C2#Closing.P#Prior"
End If

//End of Nested If

If HS.Period.IsFirst() = False Then

//check for first period

HS.Exp "C2#OpeningMth = C2#Closing.P#Prior //calculation for first period

In the given example C2


Dimension is used for
the movement of
balances

End If
End If 'HS.Year.IsFirst() = False

// End of IF statement

'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
' END - Bring Forward Opening Balances
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

* Reference: Astellas Rule file

62

Jun 22, 2015

2008 IBM Corporation

HFM

Best Practices

Declaration
Constants and Variables should begin with a identifier
e.g. vEntity, vScenario, ALL_TOPS ( Here v is used to
identify the variables and the Constant ALL_TOPS is
declared in capital letters

All variables must be declared using the Dim Statement


Use of Option Explicit will enforce this requirement

63

Jun 22, 2015

2008 IBM Corporation

HFM

Best Practices.contd

Sub Routines and Functions


Subroutines and method calls are to be called using the 'Call' syntax
with brackets e.g.
Call TransfertoBalanceSheet() should be used instead of only
TransfertoBalanceSheet()
This adds clarity to the script by showing explicitly that a Sub procedure is
being called.

' Function calls MUST use brackets even when there are no
parameters e.g.'
nParam = FunctionWithNoParams()
Not
nParam = FunctionWithNoParams

64

Jun 22, 2015

2008 IBM Corporation

HFM

Best Practices.Contd

Line Continuation Tips


Break complex formulas at a point where a line performs an action.
If you include long dimension names in the code line, break the line
to show one account per line.
Insert the mathematical operators at the beginning of the line so that
you can identify what type of action is being applied to the account in
the formula. When the line break is applied, the operators and
account are split in a logical manner.

65

Jun 22, 2015

2008 IBM Corporation

HFM

Best Practices.contd

Performance and Debugging


Because writing to a log file impacts performance, you should use
custom logging only during development and testing of your
application.
All calls to write-to-file procedures should be disabled before the
application goes to production. An easy way to disable call is to
place apostrophes in front them. This turns them into comment lines.

66

Jun 22, 2015

2008 IBM Corporation

HFM

Movement of Balance Sheet

67

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts

Movement Accounts are used to show greater visibility of the


balance sheet accounts
Some of the movement accounts are

68

Fixed Assets
Depreciation
Capital Expenditure
Currency Translation Adjustments

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure


Movement is captured in the Custom4 Dimension as shown
below.
Account is a FA account with which the C4 is attached

69

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure


Closing Balance is the final value that goes into the balance
sheet

70

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure


Opening Balance is a Calculated member
The prior periods closing balance is transferred to the Opening Balance
using Rules
Hs.Exp C4#OpeningBalance = C4#ClosingBalance.Y#Prior.P#Last

71

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure

In spite of being attached to Balance Sheet Account, the


highlighted member (Increases) behaves as Flow Account as
SwitchTypeForFlow is checked.

72

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure

In spite of being attached to Balance Sheet Account, the


highlighted member (Decreases) behaves as Flow Account as
SwitchTypeForFlow is checked and negative value is aggregated
to the parent as SwitchSignForFlow is checked.

73

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure

Calculated Member
Rules are used to calculate the Foreign Exchange Adj Values

74

Jun 22, 2015

2008 IBM Corporation

HFM

Movement Accounts - Custom Structure


Calculation of Foreign Exchange:
HS.Trans "C4#ForeignExchange", "C4#ClosingBalance", "A#ClosingRate", "

// The foreign exchange and closing balance is translated using the closing rate
HS.EXP "C4#ForeignExchange = C4#ClosingBalance C4#OpeningBalance-C4#IncreasesC4#Movement+C4#Decreases

//Foreign Exchange Calculation = Closing - Opening - Increases Movement+


Decreases
Movement

LC

Exchange Rate

Translated
Values

CTA

Opening

100

1.5

150

150

Increases

30

1.4

42

42

Decreases

-10

1.4

-14

-14

Movement

1.4

11.2

11.2

1.5

1.5

192

CTA
Closing

75

128

ForeignExchange
= 192 - 189.2 = 2.8

189.2

Jun 22, 2015

2008 IBM Corporation

HFM

Advantages
Movement defined in Customs can be attached with multiple
accounts
Usage of movement in Customs will lead to minimum hard
coding in the rules as these are not account specific
Most of the information is calculated
Easy from a maintenance perspective

76

Jun 22, 2015

2008 IBM Corporation

HFM

Translation Rules

77

Jun 22, 2015

2008 IBM Corporation

HFM

Translation Methods

2 types of Translation Methods in HFM


VAR Value at Rate
PVA Periodic Value Added

VAR: Translates entire current period balance at the


current exchange rate
PVA: Translates only the current period change in the
YTD value at the current period exchange rate

78

Jun 22, 2015

2008 IBM Corporation

HFM

Example of VAR and PVA

The PVA Setting is done in the application settings.


- PVA for Flow Accounts
- PVA for Balance Accounts
If PVA is not used, the VAR is used by default

79

Jun 22, 2015

2008 IBM Corporation

HFM

Default Translation Process


DefCurrency attributes of child entity and parent entity is compared.
- If the Defcurrency is different then the translation is initiated.

Use of Exchange rate ( Average or Closing Rate ) is decided by the business requirements
Metadata has to be configured to use these exchange rates for the translation process
For Flow Accounts ( Revenue and Expense) Average rate is used by the system for
translation if it is defined in the DefaultRateForFlow property in the Application Settings
For Balance Accounts( Asset and Liability) Closing rate is used by the system for
translation if it is defined in the DefaultRateForBalance property in the Application Settings
Type of Translation is decided by the PVA setting in the Application Settings
ECT (<Entity Currency Total>) is translated and the translated values sit in PC(<Parent
Currency>).

80

Jun 22, 2015

2008 IBM Corporation

HFM

Custom Translations Using Rules


Sub Translate()
....
....
End Sub

Rules in Sub Translate execute during


consolidation. They can also be run
from a Data Grid or Data Form using
Translate option

Sub Calculate()
If HS.Value.IsTransCur Then
...
...
End If

Rules in this section of Sub


Calculate execute only on
translated values.

End Sub

If you add a translation rule for an account to the Sub Translate procedure, the
translation rule overrides the default translation for the account.
All accounts for which rules do not exist in the Sub Translate procedure are
translated using the default translation.
81

Jun 22, 2015

2008 IBM Corporation

HFM

Translation Functions

HS.Trans

Translates a currency using YTD method ( VAR Method)


HS.Trans("DestPOV","SourcePOV","Rate1","Rate2")

Translates a currency using periodic method ( PVA Method)


HS.TransPeriodic

HS.Trans("DestPOV","SourcePOV","Rate1","Rate2")

* Trans and Transperiodic functions to override the default translations for an


account. The parameters for the two functions are identical.

82

Jun 22, 2015

2008 IBM Corporation

HFM

Translation Function Parameters

DestPOV

The destination point of view. The destination can be any combination of Account,
Custom1...4, or ICP members. For each unspecified dimension, the system writes
to all valid members of the dimension. For each specified dimension, the system
writes to the specified member only.

SourcePOV

The source point of view. The source can be any combination of dimensions. If the
Account, Custom1...4, and ICP dimensions are unspecified, the system uses the
same member as the Destination member. If the Scenario, Year, Period, and Entity
dimensions are not specified, the system uses the current members. If the Value
dimension is not specified, the system uses the Entity Curr Total member. If
SourcePOV is left blank, the system uses the destination point of view as the
source point of view.
HS.Trans "C1#Movement","","A#AvgRate",""

Rate1

The exchange rate. The rate can be a constant, an exchange rate account, or a
specific cell.

Rate2

An exchange rate to use for calculating an exchange variance.

83

Jun 22, 2015

2008 IBM Corporation

HFM

Translation rules Things to Remember

84

1.

The Source value dimension member is always <Entity Curr Total>

2.

The Destination value dimension member is always the parent


member, i.e. <Parent Currency>

3.

Calculate rule runs after the translation rule by default

4.

Calculation results are overriding in nature, whereas the Translation


results are accumulative in nature
i.e. if same destination POV is used in multiple rules with Trans or
Transperiodic , results are accumulated in the destination Account
However results do not accumulate between trans and
transperiodic functions

5.

Translation functions can be used to calculate the differences due to


exchange rates using Rate 2 in the parameters

Jun 22, 2015

2008 IBM Corporation

HFM

Calculation of Exchange Rate Differences

Let us assume cash Balance for ABC is 500 for Jan and Feb
- Exchange rate differences caused the difference in the translated values.
JAN

FEB

CASH ( PC)

750

800

EOM Rate

1.5

1.6

CASH (ECT)

500

500

- Above example shows the exchange rate difference of 50 (800-750) in


the parent currency level
(contd..)

85

Jun 22, 2015

2008 IBM Corporation

HFM

Calculation of Exchange Rate Differencescontd


Use of Translation Functions to calculate the exchange rate
HS.Trans "A#Cash.C1#EXCH_DIFF","A#Cash.C1#Opening","A#EOMRate","A#PriorEOMRate

Source Account is translated using Rate 1 i.e. EOM Rate for Feb
500*1.6 = 800
Source Account is translated using Rate 2 i.e. Prior EOM Rate for Jan
500*1.5 = 750
Difference of translated value goes to Destination Account EXCH_DIFF.
EXCH_DIFF = 50 (800 750 )

86

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Rules

87

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Process

88

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Functions

PCon

Gets the percentage of consolidation for the specified member or current


member
- HS.Node.PCon("S#Scenario.Y#Year.P#Period.E#Entity")
- HS.Node.PCon("") //applies the function to the current member

Puts value in the Proportion and Elimination. The Con function multiplies the
value of the Parent Total member by a specified factor and updates either the
Proportion member or the Elimination member of the Value dimension with the
result.

Con

This function is valid only in the Sub Consolidate procedure.


- HS.Con "DestinationPOV", Factor, "Nature
The source is the Parent Total member for the current entity, year, and
scenario.
The destination is either the Proportion or the Elimination member.

89

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Rules Things to remember

90

1.

Consolidation happens only for those accounts whose IsConsolidated


property is checked

2.

PCon is applied to Parent Total member

3.

EC (Parent Entity) = CT(Child)= P(Child) +Elim (Child)+CA( Child)

4.

For Elimination
IsICP of Elim accounts should be checked
Plug should be specified
ICP Entities should be defined
Elimination happens at the first common parent

5.

We cannot specify the Source functions in the Con function. It is always the
<Parent Total> Member. The Con function is used in conjunction with the
OpenDataUnit function, and the source account for Con is always the
account for the current item in the data unit.

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Procedure
Sub Consolidate ( )
'****** Default Consolidation ******
Set MyDataUnit = HS.OpenDataUnit("")

lNumItems = MyDataUnit.GetNumItems

For i = 0 to lNumItems-1

Call MyDataUnit.GetItem(i, strAccount, strICP, strCustom1, strCustom2, strCustom3, strCustom4, dData)


If dData <> "0" and HS.Account.IsConsolidated(strAccount) then
HS.Con "", HS.Node.PCon(""), ""

vPlug = HS.Account.PlugAcct(strAcc)

If CanEliminate(vPlug,strICP)= True Then


HS.Con "V#[Elimination]", -HS.Node.PCon(""), ""
HS.Con "A#" &vPlug& ".V#[Elimination]", HS.Node.PCon(""), ""

4
5

8
End If

End If

Next

'****** Method Specific Consolidation Rules ****** - (For Specific Consolidation Methods)
Select Case Method
Case "AFFILIATE"
Case "SUBSIDIARY

......
End Sub( )

91

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Procedure
Steps
1.

Set MyDataUnit = HS.OpenDataUnit("") Opens the data unit for the current POV and stores in the
Variable MyDataUnit

2.

lNumItems = MyDataUnit.GetNumItems Counts the record in the array MyDataUnit

3.

For i = 0 to lNumItems-1Creates a for loop for till the last record of the data unit is processed.

4.

Call MyDataUnit.GetItem(i, strAccount, strICP, strCustom1, strCustom2, strCustom3,


strCustom4, dData) Calls the first record of the data unit. Account is stored strAccount, ICP in
strICP, Customs in StrCustoms and data in dData

5.

If dData <> "0" and HS.Account.IsConsolidated(strAccount) thenEnd If Checks whether


IsConsolidated property is checked and data is present for the intersection. If true than the rest of the
procedure is processed

6.

HS.Con "", HS.Node.PCon(""), " HS.Node.Pcon() is the multiplication factor of the HS.Con
Function. It Picks the consolidation percentage of the current Member.Since nothing is specified in the
HS.Con Destination POV, the default destination is Proportion .

7.

vPlug = HS.Account.PlugAcct(strAcc) Captures the plug Account of StrAccount and stores it in


VPlug

8.

If CanEliminate(vPlug,strICP)= True ThenEnd If Calls the CanEliminate Function and checks if


the account requires InterCompany Elimination
If true,
1.
2.

9.

92

HS.Con "V#[Elimination]", -HS.Node.PCon(""), "The Con function is used to write a reversing entry to the
Elimination member
The elimination amount is written to the Elimination member of the plug account.

Use of Select Case Method to perform specific Consolidationcontd

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Procedure
Steps
Specific Consolidation rules can also be written in the Consolidate Sub routine

Sample of Specific Consolidation Rules

Select Case Method


Case "AFFILIATE"
Case "SUBSIDIARY"
'***************Calculation of Minority Interest
If (HS.GetCell("A#IssuedSubsAndPaidup." & All_Top) + HS.GetCell("A#ReservesAndSurplus." & All_Top)) > 0 Then //
Checks whether the sum of the value if IssuedSubsAndPaidUp and Reserves And Surplus is greater than 0.
Set MyDataUnit = HS.OpenDataUnit("A#prftbeforeexcptitems.I#[ICP Top]") //Open the data units
lNumItems = MyDataUnit.GetNumItems //gets the number of records in open data Unit
For i = 0 to lNumItems-1 // For loop for all the records in Open data unit
Call MyDataUnit.GetItem(i, strAccount, strICP, strCustom1, strCustom2, strCustom3, strCustom4, dData) // Calling
each record of the data unit
Call Hs.Con ("A#MICharge.V#[Elimination].I#[ICP None]", dPMin * -1 , "MI on PnL") // Specific calculation
Call Hs.Con ("A#MIPnLduringtheperiod.V#[Elimination].I#[ICP None]", dPMin * 1 , "MI on BAL SHEET") // Specific
calculation
Call Hs.Con ("A#NoASeg20.V#[Elimination].I#[ICP None].C3#Unallocated", dPMin * -1 , "MI on PnL") // Specific
calculation
Next
End If
End Select

93

Jun 22, 2015

2008 IBM Corporation

HFM

Consolidation Procedure
Elimination Function - CanEliminate
Function CanEliminate(vPlug, strICP)
vPar=HS.Parent.Member // stores the parent entity of the current member
CanEliminate = TRUE // Initial value set to true
If vPlug="" Then
CanEliminate=FALSE // If there is no plug defined, then set to False
ElseIf strICP="[ICP None]" Then // Checks for Intercompany partner
CanEliminate=FALSE // if ICP Partner is [ICPNone], then set to false
ElseIf Not HS.Entity.IsDescendant(vPar, strICP) Then // Checks if strICP is descendent
of the vPar
CanEliminate=FALSE // if not a descendant, then Set to False
End If
End Function

94

Jun 22, 2015

2008 IBM Corporation

HFM

Conclusion

There are changing requirements in the financial and


accounting systems of the business. Hence the
system design and processes should be flexible
enough to quickly adapt to these changes.
The system maintenance should be taken care at the
metadata level as much as possible
Easier to make changes in Metadata than rules

95

Jun 22, 2015

2008 IBM Corporation

HFM

Sample Rule File

This is a sample Rule File and contains the examples


shown in the training module.
This rule should not be executed for any application.

*Double Click and Open. Opens with


HFM Rules Editor or Notepad

Rule

96

Jun 22, 2015

2008 IBM Corporation

HFM

Thank You

2009 IBM Corporation

You might also like