lab 06 - hfm 11.1.2.2 rules -...

23

Upload: ngoxuyen

Post on 07-Mar-2018

254 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Page 2: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 2

 

 

 

 

 

 

 

 

 

 

31st January 2013

Author: Saravanan Singaravadivelan

Qubix International Limited 

Highclere House 5 High Street, Knaphill 

Surrey, GU21 2PG Tel: +44 (0) 1483 480222 

 

 

 

 

 

 

 

 

 

Page 3: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 3

CONTENTS  

6  RULES ....................................................................................................................... 4 

6.1  SECTION OBJECTIVES ...................................................................................................................... 4 6.2  CREATING A RULES FILE ................................................................................................................... 4 6.2.1  Creating a Simple Rules file ................................................................................................ 4 6.2.2  Creating Subroutines .......................................................................................................... 5 6.2.3  Creating Functions ............................................................................................................. 6 6.2.4  Creating Variables .............................................................................................................. 9 6.2.5  Applying Restrictions on Rules ......................................................................................... 12 6.2.6  Adding Functions to Rules ................................................................................................ 16 6.2.7  Common Calculations ...................................................................................................... 18 

6.3  LOADING AND EXTRACTING RULES................................................................................................... 22 

 

Page 4: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 4

6 RULES 

 

6.1 SECTION  OBJECTIVES 

The focus of this Chapter is to review how calculations are created and maintained in HFM. 

Rules are written in Visual Basic script to create calculations in HFM. 

Referring to the HFM Admin guide chapter for the rule functions and their use as well as looking 

through the sample rule files for examples is very useful. 

At the end of this section, you will be able to: 

Create a Rules file using Rules Editor 

Modify/Update existing Rules file 

Load and Extract Rules File 

 

6.2 CREATING  A  RULES  FILE  

6.2.1 CREATING  A  SIMPLE  RULES  FILE 

1. Launch Textpad. 

2. Open a blank new file and save it with a file name under D:\1HFMBootcamp\Rules\. 

3. We will now add some comments/explanation at the beginning of the file by using an apostrophe in front of the comment. Comment can/will be added throughout the exercise to help understanding the calculation/sections within the Rules file. Please add the comments as shown in the window below. 

Page 5: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 5

 

4. Save the file again with the same file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – First Section.rle to check the correct syntax. 

 

6.2.2 CREATING  SUBROUTINES  

5. Add the two subroutines displayed below in the Second Section, one routine for Calculate and one for Dynamic. 

 

6. For more detail and explanation on Subroutines, please refer to page 225 of the hfm_admin.pdf guide saved under D:\1HFMBootCamp\11.1.2.2 Guides\ folder. 

 

Page 6: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 6

6.2.3 CREATING  FUNCTIONS  

7. Within the Sub Calculate routine, now add the 4 lines (2 comments, 2 calculation lines) below to calculate Retained Earnings account BS5101 in the Balance Sheet. 

 

8. HS.Clear and HS.Exp are Rules functions that allow clearing and calculation of members in HFM. 

9. BS5101 is the Account (A#) for Retained Earnings, Profit is the Custom1 member (C1#) for the Profit movement line, STATRETAINEDPL is the Account (A#) for Retained Profit & Loss, AllCustom1 is the top aggregated member for Custom1 dimension. 

Page 7: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 7

   

10. Still within the Sub Calculate routine, now add the following 4 lines (2 comments, 2 calculation lines) below to calculate Retained Earnings Opening Balance line, which needs to pull from the Closing Balance line of the prior year. 

 

Page 8: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 8

11. Within the Sub Dynamic routine, now add the 2 lines below to calculate Gross Profit Margin (%) account KPI2101. 

 

12. HS.Dynamic is the Rule function that allows dynamic calculation of members in HFM. To be able to run this calculation the metadata member needs to be flagged as Dynamic in the Account Type box. 

   

13. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Second Section.rle to check the correct syntax. 

Page 9: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 9

14. Within the Sub Calculate routine , now add calculation of validation account USHV00100 “Balanced Balance Sheet – Check” as a difference between “Total Assets” and “Total Liability & Equity” accounts. 

15. Within the Sub Dynamic routine, add calculation of account KPI2103 “Return on Equity (%)” as “Profit / (Loss) After Tax” on “Equity” as a percentage. 

16. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Second Section v2.rle to check the correct syntax. 

17. For more detail and explanation on Functions, please refer to page 231 of the hfm_admin.pdf guide saved under D:\1HFMBootCamp\11.1.2.1 Guides\ folder. 

 

6.2.4 CREATING  VARIABLES 

18. We now add a Third Section (between First and Second) where we will create a constant (which is a type of variables) that we can then use to store a not‐changing string that can be used through all rules. These constants are used to specify full cross‐dimensional member names. 

 

19. Add now the two constants below. 

Page 10: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 10

 

20. The first one, ALLTOPS, applies all top members of Custom1‐4 and ICP dimension. The second one, ALLNONESXC1, applies [None] member for Custom2‐4 and ICP dimensions, but excludes Custom1. 

21. We can now apply these constants to some of the calculation lines we built earlier, i.e. calculation of Retained Earnings.  

 

22. Copy the HS.Exp expression down one line and comment out the original line, so to keep it in case we need to get back to the original script. 

 

23. Modify the copied line to include the two constants we created just before. Add ALLNONESXC1 to the left part of the equation, as we want to store the amount into a base member of all/partial dimensions. Add ALLTOPS to the right part of the equation, as we want to pull Total members of all/partial dimension. 

Page 11: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 11

 

24. As you can see from above, the constant needs to be concatenated to the dimension member using a & character. 

25. Add now all the constants shown below, which represents all the possible combination of dimension members for Custom1‐4 and ICP. You can copy this from the Third Section of the file D:\1HFMBootcamp\Rules\QBCConsol Rules – Third Section.rle. 

 

26. Now modify the calculation of the Sub Calculate routine to include the new constants. 

27. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Third Section.rle to check the correct syntax. 

Page 12: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 12

 

6.2.5 APPLYING RESTRICTIONS  ON  RULES 

28. We will now apply If/Then restriction to the Rules file. Using the D:\1HFMBootcamp\Rules\QBCConsol Rules – Third Section.rle, add the If/Then and End If strings shown below in Second Section of the file. 

 

29. The If opens the restriction and the End If closes it, the calculation included between these will only run if the condition in the If statement (entity is a base entity) has been met. Move all the calculation lines to the right, so that it will make it easier to read the script. 

 

30. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – If Then.rle to check the correct syntax. 

31. We will now apply Select Case restriction to the Rules file. Using the D:\1HFMBootcamp\Rules\QBCConsol Rules – If Then.rle, move the strings highlighted below out of the If/Then End If statement. 

Page 13: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 13

 

32. Add the Select Case strings shown below. 

 

33. Create Case for Actual scenario, where Closing Actual = Opening Actual prior year, last period. Remove any reference to BS5101, so that the rule runs for all accounts. 

 

34. Create Case for Forecast scenario, where Closing Forecast = Opening Actual prior year, last period. 

Page 14: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 14

 

35. Create Case for Budget scenario, where Closing Budget = Opening Forecast prior year, last period. 

36. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Select Case.rle to check the correct syntax. 

37. We will now apply For/Next restriction to the Rules file. 

38. First of all, let’s create a new subroutine for Consolidation, as shown in the Fourth Section of the rules file below. 

 

39. Within the Sub Consolidate routine we have inserted various variables, which are used to define the type of consolidation required, depending on the consolidation method in use. 

40. Let’s now add the For/Next restriction, as shown below. 

Page 15: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 15

 

41. The restriction above is used to loop through a list of items and will only return accounts with IsConsolidate status and with data. We now add the consolidation rule within this looping function. 

 

42. The statement above means that for those account with data and with IsConsolidate status, the system checks if the entity uses an Equity method or not and it applies the respective Consolidation rule. 

43. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – For Next.rle to check the correct syntax. 

44. Let’s now go back to the Select Case statement, where we calculated the Opening Balance for BS5101. This itself is a restriction as we only want to calculate the Opening for account BS5101. We are using Account and Custom dimension to restrict when Rules run. 

 

 

 

Page 16: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 16

45. Change this restriction to apply to all accounts, not only BS5101. 

 

46. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Custom Restriction.rle to check the correct syntax. 

47. For more detail and explanation on Conditional Rules, please refer to page 221 of the hfm_admin.pdf guide saved under D:\1HFMBootCamp\11.1.2.1 Guides\ folder. 

 

6.2.6 ADDING  FUNCTIONS  TO  RULES 

48. Add the syntax shown in the Fifth Section of the Rules below, at the bottom of the file. 

 

49. First we declare some variables and constants. 

50. The function AllTopExp is then used to concatenate the Account dimension to the other dimension defined with ALLTOPS constant, that we created earlier on in the course. 

51. Add the function GetCFMove, below function AllTopExp previously created. 

Page 17: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 17

 

52. SAllTop is another variable which takes the function AllTopExp previously created. 

53. Add now an If/Then restriction to calculate the scenario source, depending on the scenario in the Point of View. If scenario is ACTUAL or FORECAST, the source scenario needs to be ACTUAL, otherwise if scenario is BUDGET, then the source scenario needs to be FORECAST. 

 

54. Add now the GetCFMove calculation, which needs to be a difference between the account selected at the current POV and the same account at source scenario (defined with If/Then above) and previous year and last period (December).  

Page 18: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 18

 

55. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Function.rle to check the correct syntax. 

 

6.2.7 COMMON  CALCULATIONS  

56. Using the function GetCFMove we just created above, we create Cash Flow calculation for account CF3750 “Retained Earnings Movements”. This will compare the current balance of account BS5101 to the last year’s ending balance and will do the math one way or the other based on the account type. 

 

57. The statement uses the GetCFMove function on account BS5101 and places the amount into account CF3750 and uses a specific C4 “Syscalc”, which can be used for calculations like this one, to separate what’s input and what’s calculated. 

Page 19: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 19

Note: There are several moving parts to cash flow. Start with EBIT pre Exceptionals (ie, CF1000 = EBITPRE) and then calc line items to back out non cash P&L items like depreciation. For changes in the balance sheet,  one approach is to simply list the accounts within the rule for each cash flow line item. Another approach is to use a user defined field on the balance sheet accounts to indicate which line item they impact and then use a for/next loop to cycle through them and calculate the change.  

Some cashflow details will need to come from movement detail, like capital expenditures – a change in fixed assets does not adequately capture capital expenditures vs. disposals, retirements, etc. The net increase in cash is then added to the opening balance. At the end is a comparison to cash on the balance sheet. Lastly is a calculation to calculate the currency translation effect within cash flow, as the ending balance will translate at the end of month rate and the cash flow line items translate at the average rate. 

58. Create a Foreign Exchange Difference calculation within the Sub Calculate section. FX Difference needs to run at translated parent levels; therefore we will use an If/Then statement to restrict when this rule needs to run. 

59. First we add calculation of C1 Stored member, which equals C1 member TotalMvt. 

 

60. Then we need to set some Variables. 

 

61. Then we insert the If/Then Statement. 

 

62. Finally we add the calculation of Custom1 member FXDiff. 

Page 20: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 20

 

63. Create an Impact Status calculation within the Sub Calculate section. This needs to run when the period selected is the last period (I.e. Dec) and it will impact the first period of the following year. 

64. First we set the If/Then statement. 

 

65. Then we add the Impact Status calculation within the If/Then statement, so that it only runs if the condition is met. 

 

66. Create a Write to File calculation within the First Section of the Rules file. This will allow debug of new codes. 

Page 21: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 21

67. First create some variables for the debug. 

 

68. Create now a new section, Sixth Section, where to insert the Debug Subroutine. 

 

Write To File can also be used to extract data into a file or create emails by writing the text file of an email into the drop box of a mail server. 

69. Create a NoInput calculation within the Seventh Section of the Rules file. This will prevent data input for certain members specified in this part of the Rules file. 

70. First we create a new subroutine called NoInput. 

 

71. Add now the NoInput calculation to prevent data input into C4 member [None], for all accounts for value <Entity Curr Adj>. 

Page 22: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 22

 

72. Save the file with a file name or open the already created file D:\1HFMBootcamp\Rules\QBCConsol Rules – Common Calc.rle to check the correct syntax. 

 

6.3 LOADING  AND  EXTRACTING RULES  

73. Within the HFM Web, select Consolidation  Load  Application Elements and Load Rules frame. 

    

74. Click on the search icon  , browse to D:\1HFMBootcamp\Rules\, select file QBCConsol Rules – Final.rle and click on Open 

 

75. Click on Scan and if no errors proceed to next step. 

76. Click on Load. 

77. We now need to load some data so that we can check the Rules we have just uploaded onto the system. Load the two data files that have already been prepared for you under folder D:\1HFMBootcamp\Data\ToLoad. 

78. Select Documents and Choose the Grid  QBCConsol Rules Check Grid. 

Page 23: Lab 06 - HFM 11.1.2.2 Rules - dbmanagement.infodbmanagement.info/Books/MIX/Lab_06_HFM_11.1.2.2_Rules.pdf · Qubix International Limited – Hyperion HFM Bootcamp Page 4 6 RULES 6.1

 

Qubix International Limited – Hyperion HFM Bootcamp  Page 23

 

79. Select any of the cells for Jan, right click and select Calculate. This will calculate all the Rules applied in the Rules file. 

 

80. You can then cross check the data to make sure the calculation defined in the Rules file provides the correct result in the grid. 

81. To extract Rules, select Rules from the Consolidation  Extract  Appliation Elements and follow same procedure as per member lists. Please note that you can save the file with various extensions. Please use .rle file and open it using Textpad, as this will make it easier to read the file.