CalcScript651

March 27, 2018 | Author: Umakiran Tatikonda | Category: Computer Data, Data Management, Areas Of Computer Science, Computer Programming, Computing


Comments



Description

Calc Scripts© 2002 Hyperion Solutions Corporation. All rights reserved. Hyperion, Essbase, Hyperion Analyst, Hyperion Enterprise, Hyperion Pillar and Hyperion Reporting are registered trademarks of Hyperion Solutions Corporation. Hyperion Solutions, the Hyperion “H” logo, what’s going on, Hyperion Activity Based Management, Hyperion Allocations Manager, Hyperion Analyzer, Hyperion Application Link, Hyperion Customer Interaction Center, Hyperion Enterprise Reporting, Hyperion Financial Management, Hyperion Integration Server, Hyperion Objects, Hyperion Performance Scorecard, Hyperion Planning, Hyperion Reports, Hyperion Sessionizer, Hyperion Spreadsheet Add-in, Hyperion Spreadsheet Toolkit and Hyperion Web Site Analysis are trademarks of Hyperion Solutions Corporation. All other trademarks and company names mentioned are the property of their respective owners. Microsoft is a registered trademark and Windows is a trademark of Microsoft Corporation. IBM, DB2, Lotus, and 1-2-3 are registered trademarks of International Business Machines Corporation. All other brand and product names are trademarks or registered trademarks of their respective holders. No portion of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or information storage and retrieval systems, for any purpose other than the purchaser’s personal use, without the express written permission of Hyperion Solutions Corporation. Notice: The information contained in this document is subject to change without notice. Hyperion Solutions Corporation shall not be liable for errors contained herein or consequential damages in connection with the furnishing, performance, or use of this material. Hyperion Solutions Corporation 1344 Crossman Avenue Sunnyvale, CA 94089 Hyperion Essbase XTD Calc Scripts / 6.5.1 / 10.18.02 Table of Contents Preface ......................................................................................................... i Welcome to Hyperion® Essbase® XTD Calc Script Training! ....................................................... i Course Structure.................................................................................................................................... i What is in the Manual .................................................................................................................... i Conventions ..........................................................................................................................................ii 1 Introduction .......................................................................................... 1-1 Learning Essbase ...............................................................................................................................1-2 Syntax ...........................................................................................................................................1-2 Concepts.......................................................................................................................................1-2 Usage ............................................................................................................................................1-2 Techniques ...................................................................................................................................1-2 Optimization ...............................................................................................................................1-2 Creativity .....................................................................................................................................1-3 Class Overview..................................................................................................................................1-3 Reviewing calculation architecture ..........................................................................................1-3 Building calc scripts ...................................................................................................................1-3 Using calc scripts ........................................................................................................................1-3 Exercise 1-1 – Hook, Line and Sinker Company ..........................................................................1-4 Building an OLAP system .........................................................................................................1-4 Unit Summary ...................................................................................................................................1-5 2 Calculation Architecture ..................................................................... 2-1 Types of Calculation .........................................................................................................................2-2 Outline calculations....................................................................................................................2-2 Calc scripts...................................................................................................................................2-2 Outline Calculations .........................................................................................................................2-3 Default Calculation ...........................................................................................................................2-4 Default Calculation Characteristics ................................................................................................2-8 Minimizes Physical Passes Through the Database ................................................................2-8 Allows Users with Access to Specific Calc Scripts to Run the Default Calc ......................2-8 Calc Script Calculations....................................................................................................................2-9 Contents of calc scripts ..............................................................................................................2-9 Reasons for calc scripts ..............................................................................................................2-9 Functions and commands that work only in scripts .............................................................2-9 Calculation Order............................................................................................................................2-10 Data storage ...............................................................................................................................2-10 Dimension types .......................................................................................................................2-10 Dense and Sparse Dimensions ......................................................................................................2-10 T Table of Contents Hyperion Essbase Calc Scripts Dense dimensions.....................................................................................................................2-10 Sparse dimensions ....................................................................................................................2-10 Dimension tags..........................................................................................................................2-10 Block and Index Structure..............................................................................................................2-11 Generations and Levels ..................................................................................................................2-12 Block Types ......................................................................................................................................2-13 Input blocks ...............................................................................................................................2-13 Non-input blocks ......................................................................................................................2-13 Level zero blocks.......................................................................................................................2-13 Upper-level blocks....................................................................................................................2-13 Calculation Order............................................................................................................................2-14 Dense Calculations..........................................................................................................................2-14 Sparse Calculations .........................................................................................................................2-15 Calculation Order: Dense Dimensions.........................................................................................2-16 Calculation Order: Sparse Dimensions ........................................................................................2-17 Calculation Order: Dynamic Calc Versus Batch .........................................................................2-18 Calculation order exceptions .........................................................................................................2-19 Two-Pass Calculation .....................................................................................................................2-21 Calculation passes ....................................................................................................................2-21 Exercise 2-1: Review Class Files ....................................................................................................2-22 Unit Summary .................................................................................................................................2-24 3 Calculation Script Environment ......................................................... 3-1 Introducing Calc Scripts ...................................................................................................................3-2 Components of calc scripts........................................................................................................3-2 Calc Script Editor and online Help ..........................................................................................3-2 Commands and functions .........................................................................................................3-3 Using Calc Script Editor ...................................................................................................................3-4 Calc Script Editor ........................................................................................................................3-5 Associating an Essbase Outline ................................................................................................3-5 Inserting Functions (Using the Function Button) ..................................................................3-6 Checking the Syntax and Saving and Running the Calc Script ...........................................3-7 Using Essbase Documentation ......................................................................................................3-10 Inserting Functions (From on-line Help) ..............................................................................3-11 Exercise 3-1: Explore Calc Script Editor and Online Help ........................................................3-12 Reviewing Essbase Data Using Spreadsheet Add-in.................................................................3-14 Exercise Procedures..................................................................................................................3-14 Exercise 3-2: Running Calc Scripts................................................................................................3-16 Calc Script Basics.............................................................................................................................3-18 Member Calculations ...............................................................................................................3-18 2 Hyperion Hyperion Essbase Calc Scripts Table of Contents T Arithmetic Operators ...............................................................................................................3-19 Adding In-line Documentation ..............................................................................................3-20 Introduction to Calc Script Commands and Functions .............................................................3-21 Calc Script Command Categories ..........................................................................................3-21 Essbase Functions Categories .................................................................................................3-22 Exercise 3-3: Member Calculations and Mathematical Operators ...........................................3-28 Unit Summary .................................................................................................................................3-31 4 Calculation Script Commands............................................................ 4-1 Calc Member Blocks..........................................................................................................................4-2 Focusing Calculations.......................................................................................................................4-3 Focusing Calculations Using Fix...Endfix ...............................................................................4-3 Focusing Calculations Using Conditional Statements ..........................................................4-3 Focusing Calculations Using the Cross-Dimensional Operator ..........................................4-3 Calc Script Commands .....................................................................................................................4-4 Summary of Calc Script Commands ..............................................................................................4-4 Detailed Description of Calc Script Commands ...........................................................................4-6 & ....................................................................................................................................................4-6 AGG ..............................................................................................................................................4-7 ARRAY .........................................................................................................................................4-8 CALC ............................................................................................................................................4-9 CALC ALL .................................................................................................................................4-10 CALC DIM.................................................................................................................................4-11 CALC (others) ...........................................................................................................................4-13 CCONV ......................................................................................................................................4-14 CLEARBLOCK ..........................................................................................................................4-15 CLEARDATA ............................................................................................................................4-16 DATACOPY ..............................................................................................................................4-17 FIX / ENDFIX ...........................................................................................................................4-18 IF / ELSE / ELSEIF / ENDIF .................................................................................................4-19 LOOP/ENDLOOP....................................................................................................................4-22 SET ..............................................................................................................................................4-24 SET AGGMISSG........................................................................................................................4-25 SET CACHE...............................................................................................................................4-26 SET CALCHASHTBL...............................................................................................................4-27 SET CALCPARALLEL .............................................................................................................4-28 SET CALCTASKDIMS .............................................................................................................4-30 SET CLEARUPDATESTATUS................................................................................................4-32 SET FRMLBOTTOMUP ...........................................................................................................4-34 SET LOCKBLOCK ....................................................................................................................4-35 3 Hyperion T Table of Contents Hyperion Essbase Calc Scripts SET MSG ....................................................................................................................................4-36 SET NOTICE..............................................................................................................................4-37 SET UPDATECALC .................................................................................................................4-39 SET UPTOLOCAL ....................................................................................................................4-40 VAR.............................................................................................................................................4-41 Exercise 4-1: Focus Calculations using Fix / EndFix .................................................................4-42 Exercise 4-2: Focus Calculations using If / Else / Endif ...........................................................4-43 Exercise 4-3: Focus Calculations using Cross-Dimensional Operators ...................................4-44 Unit Summary ...........................................................................................................................4-45 5 Math Functions .................................................................................... 5-1 Transforming Values with Math Functions ..................................................................................5-2 Math Function Parameters...............................................................................................................5-3 Summary of Math Functions ...........................................................................................................5-3 Detailed Description of Math Functions........................................................................................5-5 @ABS.............................................................................................................................................5-5 @AVG ...........................................................................................................................................5-6 @EXP.............................................................................................................................................5-7 @FACTORIAL.............................................................................................................................5-8 @INT .............................................................................................................................................5-9 @LN, @LOG, @LOG10 .............................................................................................................5-10 @MAX, @MAXS, @MIN and @MINS ....................................................................................5-11 @MOD ........................................................................................................................................5-12 @POWER....................................................................................................................................5-13 @REMAINDER .........................................................................................................................5-14 @ROUND ...................................................................................................................................5-15 @SUM .........................................................................................................................................5-16 @TRUNCATE ............................................................................................................................5-17 @VAR..........................................................................................................................................5-18 @VARPER ..................................................................................................................................5-19 Exercise 5-1: Using Math Functions .............................................................................................5-20 Unit Summary .................................................................................................................................5-21 ............................................................................................................................................................5-24 6 Boolean Functions............................................................................... 6-1 Testing for Values Using Boolean Functions ................................................................................6-2 Boolean Function Parameters ..........................................................................................................6-2 Summary of Boolean Functions ......................................................................................................6-3 @ISACCTYPE ..............................................................................................................................6-5 @ISANCEST, @ISANCEST........................................................................................................6-6 @ISCHILD, @ISICHILD.............................................................................................................6-7 4 Hyperion Hyperion Essbase Calc Scripts Table of Contents T @ISDESC, @ISIDESC ..................................................................................................................6-8 @ISGEN ........................................................................................................................................6-9 @ISLEV .......................................................................................................................................6-10 @ISMBR......................................................................................................................................6-11 @ISPARENT, @ISIPARENT ....................................................................................................6-12 @ISSAMEGEN ..........................................................................................................................6-13 @ISSAMELEV............................................................................................................................6-13 @ISSIBLING, @ISISIBLING .....................................................................................................6-14 @ISUDA .....................................................................................................................................6-15 Using Logical Connectors with Boolean Functions ...................................................................6-16 Exercise 6-1: Using Boolean Functions.........................................................................................6-17 Unit Summary .................................................................................................................................6-18 ............................................................................................................................................................6-21 7 Member Set Functions ........................................................................ 7-1 Generating Lists Using Member set Functions .............................................................................7-2 Member Set Function Parameters...................................................................................................7-2 Summary of Member Set Functions ...............................................................................................7-3 @ALLANCESTORS ....................................................................................................................7-6 @ANCEST ....................................................................................................................................7-7 @ANCESTORS ............................................................................................................................7-8 @ATTRIBUTE..............................................................................................................................7-9 @CHILDREN.............................................................................................................................7-10 @CURRMBR ..............................................................................................................................7-11 @DESCENDANTS....................................................................................................................7-12 @GENMBRS ..............................................................................................................................7-13 @IALLANCESTORS.................................................................................................................7-14 @IANCESTORS.........................................................................................................................7-15 @ICHILDREN ...........................................................................................................................7-16 @IDESCENDANTS...................................................................................................................7-17 @ILSIBLINGS ............................................................................................................................7-18 @IRDESCENDANTS................................................................................................................7-19 @IRSIBLINGS ............................................................................................................................7-21 @ISIBLINGS...............................................................................................................................7-22 @LEVMBRS ...............................................................................................................................7-23 @LIST ..........................................................................................................................................7-25 @LSIBLINGS..............................................................................................................................7-26 @MATCH...................................................................................................................................7-27 @MEMBER.................................................................................................................................7-29 @MERGE....................................................................................................................................7-30 5 Hyperion T Table of Contents Hyperion Essbase Calc Scripts @PARENT..................................................................................................................................7-31 @RANGE....................................................................................................................................7-32 @RDESCENDANTS .................................................................................................................7-33 @RELATIVE ..............................................................................................................................7-35 @REMOVE .................................................................................................................................7-36 @RSIBLINGS .............................................................................................................................7-37 @SIBLINGS ................................................................................................................................7-38 @UDA .........................................................................................................................................7-39 @WITHATTR ............................................................................................................................7-40 @XRANGE .................................................................................................................................7-43 Exercise 7-1: Applying Member Set Functions ...........................................................................7-44 Unit Summary ...........................................................................................................................7-45 8 Relationship Functions ....................................................................... 8-1 Using Relationship Functions .........................................................................................................8-2 Relationship Function Parameters..................................................................................................8-2 Summary of Relationship Functions ..............................................................................................8-3 @ANCESTVAL ...........................................................................................................................8-4 @ATTRIBUTEBVAL ...................................................................................................................8-5 @ATTRIBUTESVAL ...................................................................................................................8-7 @ATTRIBUTEVAL .....................................................................................................................8-9 @CURGEN.................................................................................................................................8-10 @CURLEV..................................................................................................................................8-11 @GEN .........................................................................................................................................8-12 @LEV ..........................................................................................................................................8-13 @MDANCESTVAL...................................................................................................................8-14 @MDPARENTVAL ..................................................................................................................8-15 @PARENTVAL .........................................................................................................................8-16 @SANCESTVAL .......................................................................................................................8-17 @SPARENTVAL .......................................................................................................................8-19 @XREF ........................................................................................................................................8-21 How @XREF works ..................................................................................................................8-21 Defining a Location Alias...............................................................................................................8-24 Exercise 8-1: Applying Relationship Function (@ANCESTVAL) ............................................8-26 Exercise 8-2: Applying Relationship Function (@CHILDREN)................................................8-27 Exercise 8-3: Applying Relationship Function (@XREF) ...........................................................8-28 Unit Summary .................................................................................................................................8-30 9 Range and Financial Functions.......................................................... 9-1 Using Range and Financial Functions............................................................................................9-2 Range and Financial Function Parameters ....................................................................................9-2 6 Hyperion ...............9-19 @MAXSRANGE ..........9-29 @PRIORS.....................9-27 @NPV.........................................................................................................................................................................9-8 @CURRMBRRANGE ...........9-30 @PTD ................................................................................................................................................................................................................................................................................................................9-17 @MAXRANGE ..................................................................................................................................................................................................................10-11 11 Forecasting Functions .......9-34 @SYD ..........10-10 Unit Summary ...........................................9-38 10 Allocation Functions ..........................................................................................................................................................................................9-3 @ACCUM..............................................................................................................................10-8 Exercise 10-1: Applying Allocation Functions .............................................................................................................11-2 7 Hyperion .................................................................................................................................................. 10-1 Using Allocation Functions .....................9-20 @MDSHIFT...........................................................................................................................9-9 @DECLINE ...................................................................................... 11-1 Using Forecasting Functions .......................9-15 @INTEREST ...............................................10-2 Summary of Allocation Functions ................................9-14 @GROWTH.....................10-2 Common Parameters .....................................................................................................................................9-22 @MINRANGE .............................................9-37 Unit Summary ..........................................................................................................................................9-26 @NEXTS .9-35 Exercise 9-1: Applying Range Functions (@PRIOR) ...............................................................................................................................................................9-36 Exercise 9-2: Applying Financial Functions (@IRR) ...................10-5 @ALLOCATE ................................................................................................9-5 @AVGRANGE........................................................................9-23 @MINSRANGE .......................9-7 @COMPOUNDGROWTH..............................................................................9-24 @NEXT ............................................................................................................................................9-16 @IRR ........................................................................................................................................................................................................................................................................................................................9-12 @DISCOUNT...............................................................9-31 @SHIFT...................................................................................................................................................................................................................................................................................................................................Hyperion Essbase Calc Scripts Table of Contents T Summary of Range and Financial Functions ..................................................10-6 @MDALLOCATE ............................................................................................................................................................................................................................9-32 @SLN ....................................................................................................................................................................9-33 @SUMRANGE.............................................................9-28 @PRIOR .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................9-6 @COMPOUND ................................................................................................................................................................................................ ...................................................................................................12-15 @STDEVRANGE.......................................................T Table of Contents Hyperion Essbase Calc Scripts Forecasting Function Parameters..................................................................................................................................................................................................................................................................................12-4 @COUNT ............................14-12 8 Hyperion ............................................................14-2 Summary of Miscellaneous Functions ...........13-2 @TODATE ...........................................................................................................................................12-21 Exercise 12-1: Applying Statistical Functions ..............12-6 @MEDIAN .......................................................................................................................12-24 13 Date and Time Functions ...................................................................................................................................................................................................................................................................................................................................................................................................13-3 Exercise 13-1: Applying the Date & Time Function .......................................................................................................................................................................................................................................................12-17 @VARIANCE .....................12-23 Unit Summary ......................................... 12-1 Generating Lists Using Statistical Functions...................11-4 @MOVMAX ..........................................................................................................................................................................................................................................................................................12-13 @STDEVP..........................................11-8 @MOVMIN ...........................................................11-15 @TREND .....................12-9 @RANK ...........12-2 Statistical Function Parameters .....11-6 @MOVMED .............................................................11-22 12 Statistical Functions................................................... 13-1 Using Date and Time Functions....14-2 @CALCMODE ..........................................................................................................................................11-17 Exercise 11-1: Applying Forecasting Functions ............................................................................................................11-14 @SPLINE .................................................................................13-5 14 Miscellaneous Functions ............................................................................12-11 @STDEV .....................................................................................................................................14-11 @NAME...............................................................................................................................12-2 Summary of Statistical Functions ......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................11-21 Unit Summary ...............................................................................................................................................................................................................................................11-3 @MOVAVG ..................................................12-19 @VARIANCEP ............... 14-1 Using Miscellaneous Functions.................................................................................................................................................................................11-10 @MOVSUM ........................................................14-3 @CONCATENATE................11-12 @MOVSUMX...................................................................................................................................................................................12-7 @MODE...................................................................................................11-2 Summary of Forecasting Functions ................................12-3 @CORRELATION........................................................................................................................................................... ...........................................................Hyperion Essbase Calc Scripts Table of Contents T @SUBSTRING..............................................................15-3 Individual calculations ...................................................................................................................................................15-8 Exercise 15-2: Allocations...................................A-1 Possible Solutions ................................................................................................................15-2 IF or FIX.............................................................................................................................................15-10 Exercise 15-3: Product Share Analysis ... B-2 Calc ...................COGS ........................................................15-12 Unit Summary ...............................................................................................................................................15-4 Exercise 15-1: Isolating Data Using IF or FIX ...................................................................... 1 B Essbase Outlines ....................................................................................................................................................................................................15-3 Communication ..................................................... B-17 9 Hyperion ....................................................... B-5 Calc .....................................................14-13 15 Tips................................Basic ..........HLandS1 ....................................................................................................................................................................................................................................................................................................................................................................................................................... Tricks and Techniques...........................................................................15-3 IF vs FIX .................................................................................................................................................................................................................................................................................................................15-2 Two-pass calculations ..............................................15-2 Approaching Calc Scripts Solutions ...........................................................................15-14 A Suggested Answers ................HLandS2 ............15-3 Business problem ..........................................................................................................15-5 Exercise 15-1b: Isolating Data Using IF or FIX..........15-2 Blocks on equations ............................. 15-1 Calc Script Design Considerations .................................................15-7 Simpler is Usually Better....................................................................................................... B-11 Calc .....................................................15-3 Rollup considerations .............................................................................15-2 Intelligent Calcs...............................................................................................................................................................................................................................................................................................................15-2 Dense calculations before sparse calculations ...........................................................................................................B-1 Sample ...15-3 Affected data ......... T Table of Contents Hyperion Essbase Calc Scripts 10 Hyperion . The preface presents an overview of: How the class is structured An explanation of the writing conventions used in this manual Course Structure What is in the Manual This manual is your guide and reference to learning fundamental tasks and concepts for creating Calc Scripts.Preface Welcome to Hyperion® Essbase® XTD Calc Script Training! Before you begin. the instructor presents a topic conceptually by explaining its purpose. A list of the manual’s components: A Table of Contents for easy reference A Preface containing: • An overview of what is in the manual • A description of the writing conventions Chapters containing: • An introductory objectives page • Step-by-step procedures for referencing during and after class • Detailed descriptions for each Essbase Calc Script command and function • Exercises that encourage you to practice what was just presented • A Check Your Understanding section to reinforce concepts An appendix containing suggested solutions for the exercises . demonstrating how it works and guiding the students through the exercise. In this course. This explain and do procedure has proved to be a successful method. please take a moment to review this section. instructor-led training class. It contains: Step-by-step procedures Hands-on exercises Written reviews to check your understanding H H H H H H H H H The Hyperion Essbase XTD Calc Script (Calc Scripts) training is a 2-day. tips. Accounts are organized into Account Groups such as income statement.P Preface Hyperion Essbase Calc Scripts Conventions Certain formatting styles are used in this manual to help the student better understand the subject matter and the step-by-step procedures. Individual sections are noted with a helvetica/bold heading. this indicates that the parameter is optional. prefaced by . Notes. If two parameters are separated by the filter symbol |. Periods represent a specific segment of time for each data category based on that category’s frequency. Accounts can contain two levels of subaccount detail. as in this example: Accounts Accounts store and identify data for each name and category in Hyperion Enterprise. Exercises appear throughout the chapter to reinforce a new concept or task. such as: ii H H H H H H H H To set user defaults: Tables are used to define software components. balance sheet. as in this example: Setting User Defaults Step-by-step procedures begin with the steps graphic and a heading that defines the procedure. which appear in many of the commands or functions for a particular section are described in the beginning of the chapter for that command/function type. Common parameters. etc. common mistakes or cautions about the current topic. The descriptions of the individual functions and commands will demonstrate parameters passed to the commands. If the parameter is enclosed in square brackets []. this indicates one item or the other. provide related information. This section details these conventions. Time Periods Screen captures appear frequently and further clarify a topic. Some exercises contain two separate versions: ✍ Hyperion . Keystrokes that are combined. you would press the Enter key while holding down the Ctrl key. The letter x is used to refer to the drive letter in file names. text to be typed. x:\Program Files. When available. This action/result format confirms the procedure and reinforces the student of the correct action. names of files and modules and menu selections appear in Helvetica. options to be selected. the file is located in the directory. When needed. . icons are used to help identify an object or task. The end of each exercise is indicated by an end of exercise icon. Narrow Bold. such as pressing the Ctrl + Enter keys. To clear the profile. Your instructor will provide the appropriate drive letter for x. For example. a different font is used to accentuate text. click Yes. they are presented as combined versions.Hyperion Essbase Calc Scripts Preface P Since most of the exercises for this course require the creation of Calc Scripts. The following rules apply: • For Windows procedures. a result follows. text to be typed appears in Courier. indicated with the Express/Local icon. as in the following example: Change to the /home/essbase/app directory. Hyperion H H H H H 1) 2) • 1) The step-by-step procedures present the action to be performed. appear as follows: [Ctrl] + [Enter] In the example above. iii . . Throughout the step-by-step procedures and exercises. as in the following examples: Select Clear Profile. For UNIX or DOS procedures and for Calc Script examples. as in this example: • Click Properties. P Preface Hyperion Essbase Calc Scripts iv Hyperion . which is used in the exercises for the course • • . Hook Line and Sinker.1 Introduction Chapter Objectives By the end of this chapter. course objectives and course activities Describe the organization. you will be able to: • Describe the process an application designer or database administrator follows when learning an application such as Essbase XTD Preview course content. your application of Essbase improves accordingly. In many ways.1 Introduction Hyperion Essbase Calc Scripts Learning Essbase When learning an application such as Essbase. or the syntax. you follow a set of steps. Techniques After you are comfortable with syntax. The combination of Essbase syntax and concepts provides you with the basic building blocks for creating an Essbase solution. This course is designed to provide usage examples. These steps follow the natural progression in learning any complex system. Creativity Optimization Techniques Usage Concepts Syntax Syntax You learn the combination of words. concepts. Optimization Perhaps one of the most important steps in learning Essbase is how to optimize the techniques that make up an application. Usage The ability to conceptualize solutions is referred to as usage. you concentrate on learning the techniques of using Essbase. Most users learn these optimization techniques from more expert users. of Essbase to identify the parts of the system. Concepts You relate words by learning about Essbase concepts. 1-2 Hyperion . As you improve your techniques. others must learn them by trial and error. and usage. learning Essbase is like learning any language. Building calc scripts Not all calculations can be achieved with an outline calculation.and optimization. concepts. Although classroom training helps foster creativity. you examine solutions to common analytical database problems. you can develop your own creative approaches. You also explore a variety of built-in functions provided by Essbase. You develop and test calc scripts that provide appropriate results and efficient database operations. Using calc scripts Throughout the class. you explore the various uses of calculations. you acquire techniques that you can use in your working environment.Hyperion Essbase Calc Scripts Introduction 1 One of the strengths of using Essbase is that you can build a scalable online analytical processing (OLAP) system. and. Reviewing calculation architecture You begin by reviewing calculation architecture in Essbase databases. Creativity After you have mastered syntax. Class Overview During this class. Hyperion 1-3 . You now look at the basics of building a calc script: using the editor. it is experience in building applications that enables you to do so effectively. usage. techniques. A small efficient system usually retains optimum performance when scaled to a larger environment with more users and more data. Because you are already familiar with the syntax and concepts of outline calculations. testing and debugging scripts. The only way you can be creative is through mastering the basics. by working with various examples. you concentrate on the architecture of a database to determine how calculations proceed. Hook. Line and Sinker Company In this exercise. and costs. by 1998 the next generation of Smiths believed that they needed greater control and started looking for analytical tools that could help Hook. Building an OLAP system In working with a consultant. Line and Sinker Company began as a sideline for walnut farmer Claude Smith in West Point.1 Introduction Hyperion Essbase Calc Scripts Exercise 1-1 – Hook. By 1985. family-owned business. However. which he sold through the local general store. The company invested in PCs to control inventory. Line. As the fame of Smith's lures spread throughout northern California. the original company incorporated as Hook. 1-4 Hyperion . it was clear that Hook. but a wide variety of fishing tackle to sporting goods stores. Line and Sinker Company and became a wholesaler of fishing tackle throughout the United States to premium sporting goods outlets. Their search for a tool that would take advantage of existing data and for additional analysis led them to choose Essbase. & Sinker manage its business more successfully. Within five years. Line. his nephew Bob decided to start a company to market not only lures. This company forms the framework for the practical exercises presented throughout the course. One of the third generation of Smiths decided to invest in a new breed of system: an OLAP system. the following immediate analytical needs were identified: • product mix • market share • cost adjustment • forecast and budgeting • cost allocation The management of Hook. you review the history and description of the Hook. A client-server solution was implemented with some success. By the early 1950s. & Sinker realized that these were only the beginning of their analytical requirements. Line and Sinker could no longer operate as a small. sales. Smith became famous throughout Calavares County in the 1930s for his excellent lures. it was clear that these standalone systems were no longer adequate to manage the ever-growing business. Sierra Mercantile. Line and Sinker Company. California. It enables experimentation with various calc scripts. Hyperion 1-5 . appropriate data transformation. you progress towards the ultimate goal of efficiently and accurately calculating a database. usage. Efficient and accurate calculations provide required data manipulation. and techniques. and maintainability of data. you use the Hook. real-world example of a moderately complex Essbase database.Hyperion Essbase Calc Scripts Introduction 1 Unit Summary The process of learning Essbase follows a pattern common to that of learning most systems. To provide accurate data. As you master each learning level—syntax. The basic goal of this course is to provide practical tools that will assist you in building a successful Essbase layer in an OLAP system. Line and Sinker (HLandS) database for exercises. The database has a dual purpose. • • It provides a reasonable. concepts. you must consider a variety of factors. Using the builtin functionality of Essbase reduces development time and processing time. During this course. 1 Introduction Hyperion Essbase Calc Scripts 1-6 Hyperion . you will be able to: • • • • • Describe the two types of calculations (outline and calc script) available in Essbase XTD Explore data storage options that affect calculation order List the levels of calculation order Explore the need for two-pass calculations and describe the differing behavior when used in outline calculations and calc scripts Review the sample database that is used during class exercises .2 Calculation Architecture Chapter Objectives By the end of this chapter. 2 Calculation Architecture Hyperion Essbase Calc Scripts Types of Calculation Hyperion Essbase provides two basic methods of calculation. Outline calculations are placed directly in the outline, and usually are run by invoking a default calc script. Calc scripts are generally more specific, calculating a portion of the database or performing special analytical tasks. Outline calculations Outline calculations are the simplest method of calculating the database. Outline calculations are dependent on the structure of the database outline. You use outline calculations when the database has been updated, data must be consolidated, and formulas must be recalculated. Outline calculations are invoked through a default calc script. When working with large databases, you can use an alternative default calc script to aggregate only those portions of the database that have been updated. ✍ The default calculation simply runs through the outline. If Intelligent Calculation is invoked, however, the calculation is limited to calculate for updated data, only. Calc scripts You use calc scripts for more specialized calculations. These include calculating a portion of the database, or performing calculations using commands that do not work in the outline. In conjunction with outline settings, a calc script uses a combination of functions, commands and formulas to answer a specific question. 2-2 Hyperion Hyperion Essbase Calc Scripts Calculation Architecture 2 Outline Calculations Outline calculations are based on relationships between members in the database outline and on any formulas that you have attached to members in the outline. For example, the values stored for New York, Massachusetts, Florida, Connecticut and New Hampshire are added (aggregated) to calculate the total for East. Each region - East, West, South and Central - are in turn rolled up to calculate the total for Market. It is best to place calculations in the outline, where possible, for the following reasons: • • They are easier to understand in the outline than in a calc script. If the calculations can be expressed as unary relationships in the outline hierarchy using outline consolidation operators (+, -, /, *, %), they execute much faster than in formulas. There is no significant difference in efficiency between formulas in the outline and formulas in a calc script. • Hyperion 2-3 2 Calculation Architecture Hyperion Essbase Calc Scripts Default Calculation The default calculation for a database is CALC ALL. CALC ALL calculates the database by evaluating the outline from top to bottom, executing rollups and formulas in the order in which they are encountered. The execution order is automatically optimized by Essbase when CALC ALL is used. You run the default calculation from an Application Manager menu, from Esscmd or from a calc script containing the command CALC ALL. To connect to the Essbase Server: 1) 2) Ensure Hyperion Essbase OLAP Server and Hyperion Essbase Application Manager are running. To connect to the server from the Essbase Application Manager main menu, select Server / Connect. In the Essbase System Login window, select the desired Server, and type a valid Username and Password. Click OK. The server window displays: 3) To calculate a database in Essbase Application Manager: 1) 2) Connect to the Essbase Server. In the Server window, select the Application from the drop-down list. The databases for the selected application display in the Databases list. In the database list, select the database to be calculated. 3) 2-4 Hyperion Hyperion Essbase Calc Scripts 4) Calculation Architecture 2 From the main menu, choose Database / Calculate. The Calculate Database window displays: 5) Select the Calc Script that you want to execute. To choose the default calculation, select (Default). Click OK. A status window displays during the computation. When the calculation completes, the status window disappears. You may specify any calc script as the default calculation. If you use a specific script rather than CALC ALL, you use Essbase Application Manager or Esscmd to set the script as the default. To view the default calc settings: 1) 2) Connect to the Essbase Server. In the Server window, select the Application from the drop-down list. The databases for the selected application display in the Databases list. In the database list, select the database to be calculated. 3) Hyperion 2-5 2 Calculation Architecture 4) Hyperion Essbase Calc Scripts From the Essbase Application Manager main menu, choose Database / Set Default Calc. The Set Default Calc window displays: The default calculation can be either a stored calc script procedure, identified by the Use Calc Script Object option; or the calc script that is stored in the text box associated with the Use String option. From the Set Default Calc window, you can select one of two ways to change the default calc script. You may type an alternate calc script in the text box associated with the Use String option, or you may select an existing calc script file. To change the default calc settings by typing in a new calc script: 1) 2) 3) From the Set Default Calc window, select Use String. Type commands into text box associated with the Use String option in the Set Default Calc window. Click OK. To change the default calc settings by selecting an existing calc script: 1) 2) From the Set Default Calc window, select Use Calc Script Object. From the drop-down list, select the calc script that you wish to use as the default calc script. 2-6 Hyperion Hyperion Essbase Calc Scripts 3) Click OK. Calculation Architecture 2 ✍ If you use a calc script object in place of the default calc, the calc script is copied into the text box. If you change the original calc script, the calc script in the Set Default Calc window is not automatically updated. Hyperion 2-7 2 Calculation Architecture Hyperion Essbase Calc Scripts Default Calculation Characteristics You need to understand the behavior of a default calculation and consider performance. Minimizes Physical Passes Through the Database Even when two-pass calculations are specified, Essbase attempts to perform calculations in a single pass of the database. The following chart summarizes the number of passes for each combination of dimensions tagged as Accounts and each tagged as Time: Accounts Dense Sparse Dense Dense (and is the only dense dim) Dense Sparse Sparse Time None None Dense Sparse Sparse Sparse Sparse Passes 1 2 1 1 2 2 2 Allows Users with Access to Specific Calc Scripts to Run the Default Calc Users who have calc access (the ability to run calc scripts) also have access to the default calc. If you do not want users to calculate the database using the default calc script, create a default calc script that contains only a single semicolon (;). This prevents users from actually calculating the database and does not cause an error. You may want to prevent users from calculating the full database because of time and performance factors, as well as because of data consistency considerations. 2-8 Hyperion Hyperion Essbase Calc Scripts Calculation Architecture 2 Calc Script Calculations Calc scripts let you to control precisely the method and order of calculations. You can calculate only a portion or all of the data. You can calculate specific outline rollups or formulas in a calc script. You can control the order in which calculations are performed. You can also evaluate and control the effects your calc script has on block I/O. Contents of calc scripts A calc script can be very simple, containing only a single statement, such as CALC ALL, or a single function that is not available in an outline calculation, such as CCONV. Many calc scripts, however, contain a series of steps that are dictated by logical tests or by the calculation of subsets of data. Reasons for calc scripts You should use calc scripts instead of outline calculations in the following situations: Complex logic is required Calculations focus on a subset of the database Specific analytical functions are required Infrequently used calculations, such as year-end processing, that require standard scripts are needed Functions and commands that work only in scripts Some functions are not valid in an outline, particularly functions that calculate only a portion of the database: Currency conversion using Hyperion Essbase Currency Conversion Iterative processing, such as solving simultaneous equations Data management commands, such as DATACOPY and CLEARBLOCK The FIX command, used to calculate subsets of data Temporary variables Hyperion H H H H H H H H H 2-9 a product dimension and a market dimension would likely be sparse in this scenario. a crucial issue is the designation of dimensions as dense or sparse. They have special processing characteristics. such as Dynamic Time Series and Expense Reporting.2 Calculation Architecture Hyperion Essbase Calc Scripts Calculation Order Default calculation order is dependent on how data is stored in the database. Therefore. Thus. COGS and Expenses would be a likely candidate to tag as Dense. Index nodes are made up of sparse dimensions. Sparse dimensions Sparse dimensions are used when the demographics of data is likely to be thinly spread. these dimensions tend to be fairly static. Data blocks are made up of dense dimensions. cost of goods sold information. and related expense. you may not sell every product in every region. For example. Also. Dense dimensions When you examine data. you see that some dimensions are likely to contain large amounts of data. Dimension types You also review the order in which Essbase calculates each dimension type: • • Dense calculations Sparse calculations Dense and Sparse Dimensions When an Essbase database is designed. every product sold has sales information. you must understand how Essbase stores data. Data storage To predict calculation order. Sparse dimensions tend to change more frequently than dense dimensions. The next few pages present a review of the basic concepts of data storage. Dimension tags Two special types of dimensions are tagged as Accounts and Time. the dimension that contains the members of Sales. 2-10 Hyperion . For example. These concepts are vital to understanding both outline calculations and calc scripts. You can use various Essbase settings to define the amount of memory allocated for processing index nodes and data blocks. each block has an associated index node. through calculations. Data cells are defined by the dense dimensions of the database combinations. As Essbase processes data. which corresponds to the block’s combination of sparse members. The number of cells in each block equals the product of all stored members of dense dimensions. data loads or data retrievals.Hyperion Essbase Calc Scripts Calculation Architecture 2 Block and Index Structure Essbase uses two types of internal structures to store and access data: data blocks index blocks Hyperion H H The data block contains data cells (the actual values). To specify data blocks. index nodes and data blocks are read from a disk and brought into memory. 2-11 . 2 Calculation Architecture Hyperion Essbase Calc Scripts Generations and Levels Essbase vocabulary uses two methods for referencing the position of a member within a hierarchy: generation level. can be asymmetric. such as the example above. with the lowest level being Level 0. with the dimension name being Generation 1. it becomes Level 1 when traversing the branch to the states that have no city members: Massachusetts. starting at Level 0. is consolidated. if it is not tagged as Label Only. Therefore. Each dimension branch. After all lower levels of a hierarchy are calculated. Albany. is calculated up to the highest level. Hierarchies. Florida. an upper-level member such as East may be Level 2 when traversing the branch to cities (New York City. Connecticut and New Hampshire. the dimension name. and Buffalo). 2-12 H H Generations are numbered from the top of the hierarchy. Level 0 (leaf level) members have no members below them. Levels are numbered from the bottom of the branches of the hierarchy. The order of calculation within a dimension follows the level numbering. But. Hyperion . the block East->Cola was created during a sparse calculation process. a data load with rules or a spreadsheet lock and send. for example. Markets is the top member of the Markets dimension. Upper-level blocks Upper-level blocks correspond to one or more sparse members that are not level zero. Thus. Input blocks can be level zero or upper-level blocks. New York->Cola is a level zero block because New York and Cola are leaf-level members of their respective sparse dimensions. all data in the block is the result of calculation. Markets->Cola is considered upper-level.Hyperion Essbase Calc Scripts Calculation Architecture 2 Block Types Block types are determined by the way in which the block was created and by the level of the sparse combination members that define the block. the block did not exist. Markets and Products. Therefore. Before calculation. For example. For example. Level zero blocks Level zero blocks correspond to level zero members of sparse dimensions. Markets->Cola is an upper-level block. Input blocks Input blocks are created by loading data to cells in the block. Although Cola is a zero level member from the Products dimension. Hyperion 2-13 . Non-input blocks Non-input blocks are created through calculations. the dimension tagged as Time. Essbase calculates in the following order: • • • First. whether dense or sparse Third. Dense calculations proceed one block at a time until all existing blocks are calculated. Dense Calculations Dense members are calculated first when using CALC ALL. other dense dimensions (in the order that they are displayed in the database outline) • Fourth. other sparse dimensions (in the order that they are displayed in the database outline) • Fifth. whether dense or sparse Second. Dense combination cells inside each block are then calculated and filled. 2-14 Hyperion .2 Calculation Architecture Hyperion Essbase Calc Scripts Calculation Order When you perform a default calculation (CALC ALL) on your database. two-pass calculations (if selected in the database settings) Note: Two-pass calculations are sometimes calculated when the Accounts dimension is calculated. If a database includes a dimension tagged as Accounts and a dimension tagged as Time and if formulas are applied to members on the Accounts dimension. the dimension tagged as Accounts. Essbase calculates dimensions in a predetermined order. Hyperion 2-15 . Jan->Sales->Actual for East->Cola is 30 because Jan ->Sales->Actual for Vermont->Cola is 10 and Jan->Sales->Actual for New York->Cola is 20. after dense dimensions have been calculated for all existing blocks. Because all data cells in the original level zero blocks have been calculated. the newly created upper-level blocks (East->Cola) complete calculation in one step. sparse dimensions are calculated to consolidate level zero blocks into newly created upper-level blocks. Each cell in the consolidated block corresponds to the aggregate total of its counterpart cells in the zero level blocks.Hyperion Essbase Calc Scripts Calculation Architecture 2 Sparse Calculations In a default calc. For example. Margin and then Expenses Within the Measures dimension . for the sample outline. If you perform a calculation on a shared member. the calculation is actually performed on the data in the stored location.Profit. the numbers indicate the order of calculation. Shared members are pointers to a stored value.2 Calculation Architecture Hyperion Essbase Calc Scripts Calculation Order: Dense Dimensions In this outline. Notice the following: • • Calculations start at the lowest level of a branch. it is recommended to place shared members below the physically stored members. calculations move up to the next level. When the end of a sub-branch is reached. In an outline. For example. 2-16 Hyperion .Sales and then COGS Within the Profit branch . then Inventory and then Ratios. calculations occur in the following order: • • • Within the Margin branch . Hyperion Essbase Calc Scripts Calculation Architecture 2 Calculation Order: Sparse Dimensions Sparse calculations obey the same sequential rules as dense calculations. Calculation order for the above outline is as follows: Anchor Dimension A Cola Traversed Dimension 1 2 3 4 B Root Beer 1 2 3 4 And so on East West South Markets East West South Markets Hyperion 2-17 . One sparse dimension is traversed while one member of another dimension remains constant. Batch calculation order: • • • • • Dimension with Accounts tag Dimension with Time tag Dense dimensions in outline order Sparse dimensions in outline order Two-pass calculations Dynamic Calc order: • • • • • • Sparse dimensions Dynamic Time Series calculations Dimension with Accounts tag Dimension with Time tag Dense dimensions in outline order Two-pass calculations 2-18 Hyperion .2 Calculation Architecture Hyperion Essbase Calc Scripts Calculation Order: Dynamic Calc Versus Batch The calculation order of Dynamic Calc members differs from batch (outline) calculation order. 2. 3. 5. you will receive different results: Hyperion 2-19 .Total Units Florida . New York .Units per Container East Containers East . Consider the following outline: Sparse Dense A batch calculation first calculates the leaf blocks of the dense dimensions. then the Time dimension is chosen first for the sparse calculation.Total Units 10*2 = 20 10*1 = 10 10+10 = 20 2+1 = 3 20+10 = 30 If you tag East and Total Units as Dynamic Calc and run a calculation.Hyperion Essbase Calc Scripts Calculation Architecture 2 Calculation order exceptions If the dimension tagged as Time is sparse and includes Dynamic Time Series members. The following results are produced: Batch calculation results were calculated in this order: 1. Because the calculation order of batch calculations differs from the calculation order of dynamic calculations. 4. Then the upper-level blocks (East) are calculated by aggregating along the sparse dimension. tagging certain members as Dynamic Calc can create errors.Total Units East . Total Units 10+10 = 20 2+1 = 3 10*2 = 20 10*1 = 10 20*3 = 60 Thus. 3.Total Units Florida . 2-20 Hyperion . 2.Total Units East . 4.Containers New York . East . you need to be very careful in deciding when and how to apply Dynamic Calc tags.Units per Container East . 5.2 Calculation Architecture Hyperion Essbase Calc Scripts Since Dynamic Calculation calculates along the sparse dimensions before calculating the order of calculation is: 1. even if the member is not in a dimension tagged as Accounts. ✍ You can tag any Dynamic Calc or Dynamic Calc and Store member as two-pass. Calculation passes During the first pass. Two-pass calculation is also used when member calculations reference other member calculations that are not yet complete. the dimension tagged as Time is calculated and the data is rolled up across the Time dimension. Then. In the example below. when a two-pass calculation is run. but the rolled-up calculation for percent is not correct: Accounts Profit Sales Profit% (NOT tagged as two-pass) Jan 100 1000 10% Feb 100 1000 10% Mar 100 1000 10% Qtr1 300 3000 30% The second pass corrects the percentage calculation: Accounts Profit Sales Profit% (tagged as two-pass) Jan 100 1000 10% Feb 100 1000 10% Mar 100 1000 10% Qtr1 300 3000 10% ✍ Two-pass calculations work only on the Accounts dimension. the tag is ignored. calculations made at the lowest level (months) are correct.Hyperion Essbase Calc Scripts Calculation Architecture 2 Two-Pass Calculation Two-pass calculation is used when data must be calculated twice: once during rollup and once after rollup is complete. the dimension tagged as Accounts is calculated first. Although you can tag members in other dimensions as two-pass. Hyperion 2-21 . HLandS2 also contains a few more members in the Accounts dimension. The major difference between these two outlines is the design of the Scenario and Time dimensions. particularly under Statistics. The Localhost server window displays. Click Open. type Localhost. The Essbase System Login dialog displays. From the list of available databases. You also review a typical sample spreadsheet used in one exercise. select Server / Connect. you use the following files: Database CALC:HLandS1 CALC:HLandS2 CALC:COGS Spreadsheet SS_Demo. type hyperion. In the Username field. you review the Essbase database outlines used in future exercises. For this exercise. 4) 5) 6) 7) 8) 9) 10) ✍ 11) 2-22 Hyperion . Click Open. In the Server textbox. From the list of available databases. Start Essbase Application Manager. select HLandS1.2 Calculation Architecture Hyperion Essbase Calc Scripts Exercise 2-1: Review Class Files In this exercise. select CALC. In the Application field. Close the HLandS1 outline. From the Essbase Application Manager main menu. Expand each of the dimensions to obtain an understanding of the structure of the HLandS1 database. type Trnadmin. Close the HLandS2 outline. select HLandS2. HLandS2 also contains an attribute dimension (IntroDate).xls 1) 2) 3) Ensure that the Essbase OLAP server is running. Expand each of the dimensions to obtain an understanding of the structure of the HLandS2 database. In the Password field. Click OK. Hyperion Essbase Calc Scripts 12) 13) Calculation Architecture 2 From the list of available databases. A sheet containing the layout of the data that to be retrieved after executing the Calc Script you created to match the requirement for this exercise. ✍ 14) Review a Typical Excel Workbook Each exercise uses an associated Excel workbook that usually includes: • • A sheet containing data used to initially populate the Essbase database. Expand each of the dimensions to obtain an understanding of the structure of the COGS database. ✍ 18) ✍ 19) Hyperion 2-23 . You use Essbase / Retrieve in this worksheet to obtain the updated data and to confirm the correct operation of your Calc Script. You use Essbase / Calculate to run your Calc Script. The COGS database is much simpler that HLandS1 and HLandS2. you use Essbase / Lock and Essbase / Send to initialize the database’s content. select the Calc&Retrieve tab. Open the Excel workbook: SS_Demo found in the <x>:\Hyperion\Essbase\App\Calc directory. Click Open. Close the Excel workbook. select the Lock&Send tab. select COGS. It contains the (percentage) cost of goods for each product. It is used for one exercise that applies the @XREF function. 15) 16) 17) Launch Microsoft Excel. Close the COGS outline. After clearing the database. The simplest form of database calculations are those contained in the database outline. An Essbase database is made up of dense and sparse dimensions. moving from left to right. Outline calculations consist of database consolidations and member calculations. These calculations are used to ensure that the databases present consistent data to all users. You can use either of two methods to describe the calculation position in the hierarchy. moving from right to left. The order of calculation is determined by dimension type. the number increases.2 Calculation Architecture Hyperion Essbase Calc Scripts Unit Summary You must understand the structure of the Essbase database and the order in which the database is calculated before you can understand calculations. Dense dimensions are calculated before sparse dimensions. followed by sparse dimensions. All remaining dense dimensions are calculated in the order in which they appear in the outline. Dense dimensions contain data. and sparse dimensions act as index pointers to the data blocks of the dense dimensions. The lowest level of the hierarchy-the leaf level-is Level 0. a dimension tagged as Time is calculated second. The Generation and Level positions are used frequently in calc scripts. 2-24 Hyperion . As you move up the hierarchy. Levels work in the opposite direction. A dimension is often hierarchical in nature. Generations start at the top of the outline and count forward or down. A dimension tagged as Accounts is calculated first. Hyperion Essbase Calc Scripts Calculation Architecture 2 þ Check Your Understanding Now that you have completed the chapter. check your understanding by responding to the following questions: 1) What is the default calculation order when performing a database consolidation? 2) When would you use a calc script instead of the default calc? 3) Why would you use Two-pass calculation? Hyperion 2-25 . two-pass calculations (if selected in the database settings) When would you use a calc script instead of the default calc? You should use calc scripts instead of outline calculations in the following situations: • Complex logic is required. 2) 3) 2-26 Hyperion . • Specific analytical functions are required. Why would you use Two-pass calculation? Two-pass calculation is used when data must be calculated twice: once during rollup and once after rollup is complete. Essbase calculates in the following order: • First. • Infrequently used calculations. the dimension tagged as Accounts. Two-pass calculation is also used when member calculations reference other member calculations that are not yet complete. the dimension tagged as Time. such as year-end processing. that require standard scripts are needed. other dense dimensions (in the order that they are displayed in the database outline) • Fourth. other sparse dimensions (in the order that they are displayed in the database outline) • Fifth. whether dense or sparse • Second. whether dense or sparse • Third. • Calculations focus on a subset of the database.2 Calculation Architecture þ Check Your Understanding Solutions 1) Hyperion Essbase Calc Scripts What is the default calculation order when performing a database consolidation? If a database includes a dimension tagged as Accounts and a dimension tagged as Time and if formulas are applied to members on the Accounts dimension. you will be able to: • • • • • • Describe the reasons for using calc scripts Demonstrate how to use the Calc Script Editor and online Help to build calc scripts Describe the use of member calculations and arithmetic operators List the types of commands and functions available to create calc scripts Create and execute a simple calc script Add in-line documentation to a calc script .3 Calculation Script Environment Chapter Objectives By the end of this chapter. or Fortran can draw an analogy to multidimensional arrays. You create calc scripts to solve more complex and unusual analytical problems. Online Help provides access to appropriate syntax. Calc scripts extend the analytical functionality of Essbase beyond the pro forma report that is presented when viewing a simple Essbase spreadsheet. to calculate specific portions of the database and to develop business scenarios that are not used in every day reporting. Programmers who have worked with C++. they do not take full advantage of the OLAP strengths of Hyperion Essbase. which is invoked from Essbase Application Manager. they are working with a polyhedron that has as many sides as there are dimensions in the database outline. The language provides not only for a variety of calculation functions but also for a variety of Boolean tests and for program control (if-tests and looping). you further simplify the creation of calc scripts. The greatest challenge the new Essbase programmer faces is thinking multidimensionally. it will be used.3 Calculation Script Environment Hyperion Essbase Calc Scripts Introducing Calc Scripts As powerful as outline calculations are. ensuring that every user starts with the same data. all functions and calculations that are used in calc scripts can also be used in an outline. Components of calc scripts The Essbase calc script language possesses many of the calculation components with which programmers are familiar. To simplify the process. Outline calculations provide a baseline for all analysis activities. for example. Relational database programmers must always remember that they are not working with a flat structure. By cutting and pasting from online Help. Rather. the Calc Script Editor provides lists of database dimensions and members as well as lists of functions and commands. Calc Script Editor and online Help You can create calc scripts using Notepad or any text processor. Hyperion Essbase Application Manager provides a tool called the Calc Script Editor. examples of each function and a description of the command usage. With the exception of a few commands and looping. Java. It also provides a syntax checker. If an outline consolidation is in a calc script. 3-2 Hyperion . Calc scripts and outline calculation work together. clearing blocks. from calculating an entire database to calculating a single dimension Data isolation commands that specify a portion of the database to be calculated Data management commands that allow for copying data. on a range of values Math functions that perform a variety of mathematical operations Calc scripts also provide a full range of operators and connectors.Hyperion Essbase Calc Scripts Calculation Script Environment 3 Commands and functions Calc script commands include the following subcategories: • • • • Commands that control calculation. such as sum. Hyperion 3-3 . and clearing an entire database Environmental commands that control output to the log. These commands and functions are studied in detail throughout this course. and optimize calculations Calc script functions usually begin with an @ sign and include the following subcategories: • • • • • • Boolean functions that test for member relationships Member set functions that return a list of members Relationship functions that return a value based on the current position of a calculation Range functions that return a single value after performing a calculation. manage the calculation environment. From the Calc Scripts list. Click New.3 Calculation Script Environment Hyperion Essbase Calc Scripts Using Calc Script Editor Calc Script Editor is accessed from Essbase Application Manager. select the application and database. Creating a New Calc Script: 1) From the server window of the Hyperion Application Manager. Click Open. The names of the existing calc scripts display in the Calc Scripts list. The Calc Script Editor window displays: Opening an Existing Calc Script: 1) From the server window of the Hyperion Application Manager. 3) 4) 3-4 Hyperion . select the name of the Calc Script to be opened. 2) 3) Click Calc Script . 2) Click Calc Script . select the application and database. copy. the selected outline’s dimensions and members display in the appropriate lists (at the bottom half of the Calc Script Editor window). Buttons that.Hyperion Essbase Calc Scripts Calculation Script Environment 3 The Calc Script Editor window displays. you may select the outline with which to associate the calc script. Hyperion H H H H H H H A button that accesses the complete list of commands and functions: Cut. when clicked. include most common unary operators: Associating an Essbase Outline When editing a calc script. Clicking on an item in the Member list will copy it to the edit area.The selected calc script is in the edit area: Calc Script Editor Calc Script Editor minimizes typing by providing the capability to select from: Lists of dimensions and members for the associated Essbase outline. save and print: Check the calc script syntax: Associate an outline with the Calc Script 3-5 . Once associated. paste and undo: Other functionality on the Calc script toolbar include: Open. expand the dimension’s definition in the Members list to reveal the item that you wish to include. Select the item in the Members list. Click OK. click the Associate button from the main menu. The Associate Server Outline Object window displays: . they may be selected for inclusion. Application and Database. If necessary. select the Server. 3-6 Hyperion . select Options / Associate Outline. Instead of memorizing and typing in these commands.3 Calculation Script Environment Hyperion Essbase Calc Scripts Associating a Hyperion Essbase Outline: 1) In the Calc Script Editor window. The selected item is copied to edit area at the current cursor position. select the dimension that contains the item (dimension or member) to be copied to the edit area. Selecting Items from the Associated Outline: 1) In the Dimensions list of the Calc Script Editor window. 2) 3) If necessary. or The default selections are to use the application and database that was created with. The outline’s dimension display in the Dimension list of the Calc Script Editor window. 2) 3) Inserting Functions (Using the Function Button) There is a large variety of commands and functions that can be included in a calc script. Once the calc script is saved. The command’s template displays below the Categories list. and if you want to include the function’s arguments. The function / command is added at the cursor position of the edit area in Calc Script Editor window. Click OK. 2) From the Categories list. the Insert Arguments check box becomes available. select the category that contains the function or command that you wish to include. it can be run to update the data in the selected Essbase database. 3) 4) 5) Checking the Syntax and Saving and Running the Calc Script The Calc Script Editor includes the capability to determine if the script contains errors. select Insert Arguments. If available. select the desired function or command. In the Templates list. Depending on the command/function selected. The functions of the selected category are displayed in the Templates list. click Functions The Function Templates window displays: . Hyperion 3-7 .Hyperion Essbase Calc Scripts Calculation Script Environment 3 Inserting Commands and Functions: 1) In the Calc Script Editor window. or from the main menu select Syntax / Check Syntax. or from the main menu select File / Save. The next error displays on the Calc script Editor’s status line. 2) To view the next error. The previous error displays on the Calc script Editor’s status line. select Syntax / Previous Error from the main menu. “No more errors” will display on the status line if there are no prior syntax errors in the calc script. select Syntax / Next Error from the main menu.3 Calculation Script Environment Hyperion Essbase Calc Scripts Checking the Syntax: 1) After you enter the calc script. In this example. click Syntax Checker . 3-8 Hyperion . The updated calc script is saved. “No more errors” will display on the status line if there are no further syntax errors in the calc script. A message will display on the Calc script Editor’s status line to identify the first error encountered. 3) Saving an Existing Calc Script: 1) Click the Save button on the toolbar. To view the previous error. the semicolon is missing: “No errors” will display on the status line if no syntax errors exist in the calc script. the status message dismisses. click Calc Script . Once the calc script is completed. Application and Database to be updated. or from the main menu select File / Save or File / Save As. 4) Hyperion 3-9 . Click OK. Click Run. type the name that want to which you want to save the calc script.Hyperion Essbase Calc Scripts Calculation Script Environment 3 Saving a New Calc Script: 1) Click the Save button on the toolbar. From the Calc Scripts list. The Save Server Object dialog displays: 2) 3) In the Object Name field. The Essbase Operation status message displays while the calc script is running. select the Calc Script to be executed. Running a Calc Script (Application Manager): 1) 2) 3) From the server window. Select the Server. Click OK. The Select Database window displays. respectively. The easiest way to access the documentation is from the Information Roadmap. by selecting Programs / Hyperion Solutions / Hyperion Essbase/ OLAP Server Documentation: The following resources are most useful to you when creating calc scripts: • Database Administrator's Guide. The documentation for the Calc Script commands and Essbase functions can be accessed from Hyperion Essbase Application Manager. This is distributed as HTML for quick on-line reference. administrators and users. • 3-10 Hyperion . From the main menu select Help / Calculation Commands or Help / Functions. This can be accessed from the Windows Start menu. and as a PDF for producing a printed copy of the guide.3 Calculation Script Environment Hyperion Essbase Calc Scripts Using Essbase Documentation Several documentation sources are available to Essbase developers. Technical Reference also provides an invaluable on-line resource for obtaining information about Calc Script commands and Essbase functions. the syntax of a required statement can be copied from the on-line help into the Calc Script Editor’s edit area. Using Windows copy and paste functions. Hyperion 3-11 .Hyperion Essbase Calc Scripts Calculation Script Environment 3 Inserting Functions (From on-line Help) The documentation for each function and command includes a description of the syntax. The Calc Dim(dimList) statement is copied to the Calc Editor edit area. you use the following files: Database Calc Script (new) CALC:HLandS1 CSDemo 1) 2) 3) Start Essbase Application Manager. or click the semi-colon button on the toolbar. Click OK. The statement in the edit area reads CALC DIM (Accounts) Place the cursor at the end this line (and click). You use the functions template option in Calc Script Editor to create a line of a calc script. on a new line.3 Calculation Script Environment Hyperion Essbase Calc Scripts Exercise 3-1: Explore Calc Script Editor and Online Help In this exercise. In HTML Help. Create a new calc script. select Accounts from the Members list box. In the Calc Script Editor. 4) 5) 6) Click the Calc Script Editor function button . For this exercise. copy the syntax of @VAR to the clipboard. select Accounts from the Dimensions list box. and then paste the contents from the clipboard. select Calc Dim. 7) 8) 9) 10) 3-12 Hyperion . Either type a semicolon. Switch to HTML Help by selecting Help / Functions. Associate the calc script with the HLandS1 outline. From the list of available databases. you experiment with Calc Script Editor. and locate the @VAR function. You also use the HTML Help to create another. From the Categories list box of the Function Template. type in Variance =. In the edit area. select Functional. and connect to the CALC application. From the Templates list box. highlight dimList in the CALC DIM parentheses. select HLandS1. The statement in the edit area reads CALC DIM (Accounts). Press [Enter]. However. Note: In the database outline. This exercise duplicates the Variance formula. ✍ 12) 13) 14) If there are errors. Reverify the syntax. Save the calc script as CSDemo. insert Actual and Budget into the formula in that order. review your calc script to ensure the syntax and punctuation is correct (according to step 11). Verify the syntax by selecting Syntax / Check Syntax or by clicking the Syntax Checker button on the toolbar. Budget). Variance has a formula. it would override the formula in the outline. Variance = Var(Actual. The statements in the edit area reads: CALC DIM (Accounts). if the calc script calculated Variance differently. Hyperion 3-13 . Make sure that punctuation is correct.Hyperion Essbase Calc Scripts 11) Calculation Script Environment 3 Using the Members list box. A worksheet formatted to retrieve specific data from the updated Essbase database. Click OK to the Clear Data confirmation message.3 Calculation Script Environment Hyperion Essbase Calc Scripts Reviewing Essbase Data Using Spreadsheet Add-in Once the database has been populated and the calc script has been executed. Click Yes to the “Are you sure. Exercise Procedures For the remaining exercises for this course. 3-14 H H H H H H H H H 1) 2) 3) 4) The general process for remaining exercises is: Clear the data in the database. Retrieve the database results into the spreadsheet (Calc & Retrieve sheet). Each workbook has: A worksheet with data required to support the specific exercise. This worksheet is usually named Calc&Retrieve. other worksheets used to retrieve selected data. From the main menu. Populate the database with data in a spreadsheet (Lock & Send sheet). If unexpected results are retrieved. Clearing the Database (Application Manager): In the server window of Hyperion Essbase Application Manager. Calculate the database using the Calc Script that you create to solve the exercise problem. Compare the results with the expected results. select Database / Clear Data / All. Each exercise has a pre-built Excel workbook available..?” message. you use the Spreadsheet Addin with Microsoft Excel to perform many of the steps. There are a number of tools available to retrieve Essbase data. Possibly. select the application and database. you review the results. Hyperion . repair the Calc Script and repeat Calculation and Retrieve.. This worksheet is usually named Lock&Send. Click OK. (or double-click in an empty cell). connect to the appropriate Essbase database. After connecting to the selected server. Hyperion 3-15 . 3) Populating the Database (Spreadsheet Add-in): 1) 2) 3) In the desired worksheet. select the Calc Script to be run. select Calculate. Select Essbase / Lock. Running a Calc Script (Spreadsheet Add-in): 1) 2) 3) Select Essbase / Calculation. In the Essbase System Login window. Select the appropriate Application/Database combination from the list. connect to the appropriate Essbase database. Username and Password. a list of all applications and databases available to the user from that server is displayed. In the Essbase Calculation dialog.Hyperion Essbase Calc Scripts Calculation Script Environment 3 Connecting to the Essbase Database (Spreadsheet Add-in): 1) 2) In the desired worksheet. select Essbase / Connect. Click OK at the message stating “Your calculation is finished”. Click Essbase / Retrieve. Select Essbase / Send. Retrieving Essbase Data (Spreadsheet Add-in): 1) 2) In the desired worksheet. provide the Server name. Click OK. 3 Calculation Script Environment Hyperion Essbase Calc Scripts Exercise 3-2: Running Calc Scripts In this exercise. Run the Calc Script 7) From the Calc&Retrieve sheet. You also are introduced to the application log and the messages written to the log during a calculation. run the CSDemo calc script. 3-16 Hyperion . You run the calc script and view results in a spreadsheet. Budget). open SS_Demo from the <x>:\Hyperion\Essbase\App\Calc directory. 2) Correct any errors in the calc script if they exist. Review the Spreadsheet 3) 4) In Microsoft Excel. Variance = @VAR (Actual. For this exercise. Send the Spreadsheet Data to Essbase 5) 6) Connect to the Essbase server and select the Calc:HLandS1 database.xls Clear the Essbase Database 1) In Essbase Application Manager. Lock and send the data in the Lock&Send sheet to the HLandS1 database. Select the Lock&Send tab. It should contain the following statements: CALC DIM (Accounts). you use the calc script created in the previous exercise. review the calc script CSDemo. you use the following files: Database Calc Script Spreadsheet CALC:HLandS1 CSDemo SS_Demo. The Log Viewer window displays. Click Date and in the drop-down list select today's date. close. Click OK. 15) 16) Hyperion 3-17 . CSDemo: SET MSG SUMMARY. save. Close the Event Log Viewer window. 14) In Essbase Application Manager. Find and review the log entry that contains information regarding your calculation. In Microsoft Excel. What is the elapsed time for your calculation? _____ seconds. close the SS_Demo spreadsheet. 10) 11) 12) Modify and Run the Calc Script 13) Add the following command to the beginning of calc script.Hyperion Essbase Calc Scripts Calculation Script Environment 3 Retrieve the Updated Data 8) Perform a retrieval from the Essbase database and notice the calculation results. Retrieve data in the Retrieve Variance sheet to check the variance calculation. View the application log once again. and notice how the SET MSG SUMMARY command affects the log entries for the calculation. Review the Application Log 9) In Essbase Application Manager From the server window. How many blocks were created by this calculation? ______ Blocks. Scroll down to the bottom of the log entries. select Application / View Event Log. and run the CSDemo calc script. The View Log File dialog displays. mbrName1.Member defined in the database outline whose results are to be calculated. 3-18 Hyperion . mbrName2).3 Calculation Script Environment Hyperion Essbase Calc Scripts Calc Script Basics Member Calculations If. In other words. be sure that when calculating. Syntax mbrName. the lower level members have been properly calculated first. mbrName2 . in a calc script. (mbrName1. Notes The member is calculated according to the operations defined in the Essbase outline. these values are treated as zero. you reference a member name and follow the name with a semicolon. mbrName. the named member is calculated. If the member being calculated is dependent upon lower members that have missing values. Ave = (“First Value” + “Second Value” + “Third Value”) / 3. “Margin” = “Net Income” / “Gross Revenue”. Subtracts. Member1%Member2 evaluates Member1 as a percentage of Member2. For example. mbrName .member name within the same dimension as mbrName or constant value. Syntax mbrName = value1 <operator> value2. Multiplies.Member defined in the database outline whose results are to be calculated.06. Hyperion 3-19 . “Sales Pct” = Sales % “Total Sales”. The calculation method for the member can be defined in the calc script. Controls the order of calculations and nests equations and formulas. value1. Evaluates percentage.Hyperion Essbase Calc Scripts Calculation Script Environment 3 Arithmetic Operators The method by which to calculate a member may not be defined in the Essbase outline. Valid mathematical operators: + * / % Adds. Divides. value2 . () Examples “Sales Tax” = Sales * . Syntax /* Free form text */ or // Single-line of free form text The free-form text can be anything that you like. Examples // Sales Tax rate is 6% “Sales Tax” = Sales * . A single comment can be split over multiple lines in the calc script source file using the /* characters. /*.3 Calculation Script Environment Hyperion Essbase Calc Scripts Adding In-line Documentation Comments can be added to your calc scripts to document your logic. or to provide other users with information about the calc script. When Essbase’s Calc Script interpreter encounters the opening comment characters. it ignores everything following it on that single line. //. it ignores everything following it until the closing comment characters are encountered.06. /* Margin is calculated as Net Income divided by Gross Revenue */ “Margin” = “Net Income” / “Gross Revenue”. When Essbase’s Calc Script interpreter encounters the opening comment characters. 3-20 Hyperion . clicking the Calc Script Editor functions button displays the Function Template dialog: Essbase calc script commands and Essbase functions are listed by specific categories. The categories are introduced here. and a chapter is devoted to the specific commands in each category. Calc Script Command Categories The categories that contain Calc Script commands are: Data Declarations Control flow commands Functional Conditionals Hyperion H H H H A command template can be found by selecting its category: Command AGG ARRAY CALC CCONV CLEARBLOCK CLEARDATA DATACOPY ELSE ELSEIF ENDFIX Select Category Functional Data Declarations Functional Functional Functional Functional Functional Conditionals Conditionals Control Flow 3-21 .Hyperion Essbase Calc Scripts Calculation Script Environment 3 Introduction to Calc Script Commands and Functions As described earlier. 3 Calculation Script Environment Hyperion Essbase Calc Scripts Command ENDIF ENDLOOP FIX IF LOOP SET VAR Select Category Conditionals Control Flow Control Flow Conditionals Control Flow Functional Data Declarations Essbase Functions Categories The categories that contain Essbase functions are: Boolean Relationship functions Math Member Set Range (Financial) Allocation Forecasting Statistical Date & Time Miscellaneous 3-22 H H H H H H H H H H A function template can be found by selecting its category: Function @ABS @ACCUM @ALLANCESTORS @ALLOCATE @ANCEST @ANCESTORS @ANCESTVAL @ATTRIBUTE @ATTRIBUTEBVAL Select Category Math Range (and Financial) Member Set Allocation Member Set Member Set Relationship Functions Member Set Relationship Functions Hyperion . Hyperion Essbase Calc Scripts Calculation Script Environment 3 Function @ATTRIBUTESVAL @ATTRIBUTEVAL @AVG @AVGRANGE @CALCMODE @CHILDREN @COMPOUND @COMPOUNDGROWTH @CONCATENATE @CORRELATION @COUNT @CURGEN @CURLEV @CURRMBR @CURRMBRRANGE @DECLINE @DESCENDANTS @DISCOUNT @EXP @FACTORIAL @GEN @GENMBRS @GROWTH @IALLANCESTORS @IANCESTORS @ICHILDREN @IDESCENDANTS @ILSIBLINGS Select Category Relationship Functions Relationship Functions Math Range (and Financial) Miscellaneous Member Set Range (and Financial) Range (and Financial) Miscellaneous Statistical Statistical Relationship Functions Relationship Functions Member Set Range (and Financial) Range (and Financial) Member Set Range (and Financial) Math Math Relationship Functions Member Set Range (and Financial) Member Set Member Set Member Set Member Set Member Set Hyperion 3-23 . 3 Calculation Script Environment Hyperion Essbase Calc Scripts Function @INT @INTEREST @IRDESCENDANTS @IRR @IRSIBLINGS @ISACCTYPE @ISANCEST @ISCHILD @ISDESC @ISGEN @ISIANCEST @ISIBLINGS @ISICHILD @ISIDESC @ISIPARENT @ISISIBLING @ISLEV @ISMBR @ISPARENT @ISSAMEGEN @ISSAMELEV @ISSIBLING @ISUDA @LEV @LEVMBRS @LIST @LN @LOG Select Category Math Range (and Financial) Member Set Range (and Financial) Member Set Boolean Boolean Boolean Boolean Boolean Boolean Member Set Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean Boolean Relationship Functions Member Set Member Set Math Math 3-24 Hyperion . Hyperion Essbase Calc Scripts Calculation Script Environment 3 Function @LOG10 @LSIBLINGS @MATCH @MAX @MAXRANGE @MAXS @MAXSRANGE @MDALLOCATE @MDANCESTVAL @MDPARENTVAL @MDSHIFT @MEDIAN @MEMBER @MERGE @MIN @MINRANGE @MINS @MINSRANGE @MOD @MODE @MOVAVG @MOVMAX @MOVMED @MOVMIN @MOVSUM @MOVSUMX @NAME @NEXT Select Category Math Member Set Member Set Math Range (and Financial) Math Range (and Financial) Allocation Relationship Functions Relationship Functions Range (and Financial) Statistical Member Set Member Set Math Range (and Financial) Math Range (and Financial) Math Statistical Forecasting Forecasting Forecasting Forecasting Forecasting Forecasting Miscellaneous Range (and Financial) Hyperion 3-25 . 3 Calculation Script Environment Hyperion Essbase Calc Scripts Function @NEXTS @NPV @PARENT @PARENTVAL @POWER @PRIOR @PRIORS @PTD @RANGE @RANK @RDESCENDANTS @RELATIVE @REMAINDER @REMOVE @ROUND @RSIBLINGS @SANCESTVAL @SHIFT @SIBLINGS @SLN @SPARENTVAL @SPLINE @STDEV @STDEVP @STDEVRANGE @SUBSTRING @SUM @SUMRANGE Select Category Range (and Financial) Range (and Financial) Member Set Relationship Functions Math Range (and Financial) Range (and Financial) Range (and Financial) Member Set Statistical Member Set Member Set Math Member Set Math Member Set Relationship Functions Range (and Financial) Member Set Range (and Financial) Relationship Functions Forecasting Statistical Statistical Statistical Miscellaneous Math Range (and Financial) 3-26 Hyperion . Hyperion Essbase Calc Scripts Calculation Script Environment 3 Function @SYD @TODATE @TREND @TRUNCATE @UDA @VAR @VARIANCE @VARIANCEP @VARPER @WITHATTR @XRANGE @XREF Select Category Range (and Financial) Date and Time Forecasting Math Member Set Math Statistical Statistical Math Member Set Member Set Relationship Functions Hyperion 3-27 . and Commission using a simple mathematical operation). Review the Spreadsheet 2) In Microsoft Excel. Select the Lock&Send tab. 4) 5) Create and Run the Calc Script 6) 7) In Essbase Application Manager. products and months.3 Calculation Script Environment Hyperion Essbase Calc Scripts Exercise 3-3: Member Calculations and Mathematical Operators This exercise guides you through creating. Review the contents This sheet contains data to populate Level-0 data items for Actual “Pre Tax Profit” for selected cities. testing and modifying a simple calc script to calculate Account members (“Pre Tax Profit”. using the outline consolidation. Send the Spreadsheet Data to Essbase 3) Connect to the Essbase server and select the CALC:HLandS1 database. Create a new calc script. connect to the CALC:HLandS1 database. clear all the data for the specified database. 3-28 Hyperion . From the Calc&Retrieve1 worksheet. Lock and send the data in the Lock&Send sheet to the HLandS1 database. and associate it with the HLandS1 outline.xls Clear the Essbase Database 1) In Essbase Application Manager. retrieve the data from the Essbase database. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSSimple SS_Simple1. You use the Spreadsheet Add-in to review the results. Note that all values for “Pre Tax Profit” are “#Missing”. For this exercise. open SS_Simple1 from the <x>:\Hyperion\Essbase\App\Calc directory. Hyperion 3-29 . click the Calc&Retrieve1 tab of the SS_Simple1. “Total Expenses”.xls spreadsheet. In Microsoft Excel. In Microsoft Excel.) Modify and Run the Calc Script 18) From the Calc&Retrieve2 worksheet. Verify the calc script. Do the “Pre Tax Profit” value now seem to be correct? (The “Pre Tax Profit” for “Round Bodied Floating” in Bridgeport for January 1999 should be 370. “Pre Tax Profit”. 14) 15) 16) 17) Verify and save the calc script. In Microsoft Excel. There are now values for “Pre Tax Profit”. add the following to the end of the CSSimple Calc Script: Commission = . In Essbase Application Manager.Hyperion Essbase Calc Scripts 8) 9) 10) 11) 12) Calculation Script Environment 3 In the new calc script file. Retrieve the data from the Essbase database.xls spreadsheet. Retrieve the data from the Essbase database. Run the CSSimple calc script.1 * Sales.814. Note that all values for Commission are “#Missing”.) Correct and Run the Calc Script 13) In Essbase Application Manager. retrieve the data from the Essbase database.review the data in the Lock&Send sheet. click the Calc&Retrieve2 tab of the SS_Simple1.xls spreadsheet. and save it as CSSimple. click the Calc&Retrieve1 tab of the SS_Simple1. modify the calc script file to be: “Margin”. 19) 20) 21) Verify and save the calc script. “Regional Profit”. Run the CSSimple calc script. Do they seem to be correct? How was this value arrived at? (Hint . add a command to calculate: “Pre Tax Profit”. and retrieve the results until they are as expected. 25) 3-30 Hyperion . display. If the expected results are not retrieved.3 Calculation Script Environment 22) 23) 24) Run the CSSimple calc script. calculated to be 10% of the sales. open). The commissions. Close the Excel spreadsheet (but leave Excel. continue to correct and execute the Calc Script. Hyperion Essbase Calc Scripts Retrieve the data from the Essbase database. or you can select appropriate functions and paste them to the edit window. Online Help provides detailed explanations and examples of functions. and functions. Calc scripts can be created using Calc Script Editor in Essbase Application Manager. which perform an action. you can solve almost any business-related calculation problem. These actions are not included in the database outline because they are designed to solve a specific analytical task or to make adjustments that do not affect the entire database. By understanding the structure of a database and the nature of the tasks to be accomplished. You can type directly into the editor. A calc script can also contain tests that direct how and under what conditions calculations are performed. which return a value. Hyperion 3-31 .Hyperion Essbase Calc Scripts Calculation Script Environment 3 Unit Summary You create calc scripts to perform specific actions on a database or a portion of a database. Calc script syntax is both simple and powerful. A calc script can contain a single command or function or a variety of commands and functions. Calc scripts are made up of commands. /* Time dimensions are consolodated */ c. January. b. check your understanding by responding to the following questions: What are advantages of using the Calc Script Editor rather than creating your calc script in a text editor? 2) Describe what each of the following calc scripts statements do: a. “Profit Pct” = Profit % Sales. 3-32 Hyperion .3 Calculation Script Environment þ Check Your Understanding 1) Hyperion Essbase Calc Scripts Now that you have completed the chapter. 2) Calculates the member “January”. c. b. /* Time dimensions are consolidated */ Places a comment (in-line documentation) in the Calc script. Calculates a member “Profit Pct” to be the “percent of Profit to Sales”. “Profit Pct” = Profit % Sales. January.Hyperion Essbase Calc Scripts Calculation Script Environment 3 þ Check Your Understanding Solutions 1) What are advantages of using the Calc Script Editor rather than creating your calc script in a text editor? The Calc Script Editor offers: • A mechanism for selecting functions from lists (instead of having to type them) • A mechanism for selecting dimensions and measures from the outline definition (instead of having to type them) • A syntax verification tool Describe what each of the following calc scripts statements do: a. Hyperion 3-33 . 3 Calculation Script Environment Hyperion Essbase Calc Scripts 3-34 Hyperion . you will be able to: • • • • Create a calc member block Describe how to focus calculation areas using FIX.ENDIF and cross-dimensional operators Describe the basic commands used to create calc scripts Apply these commands to a series of incremental exercises ... IF..4 Calculation Script Commands Chapter Objectives By the end of this chapter.ENDFIX.. 1.1 “Net Sales” = Sales * . For example: Sales ( Sales * . ).1. In these situations. By specifying a formula in the calc script. Syntax mbrname ( <calculation statement(s)>. ). For example.9. Hyperion . 4-2 H H Occasionally. ). Example These two blocks are produce the same results: Commission ( Sales * . Commission ( Commission = Sales * . The member is calculated using the formula in the calc script. Here the calculation defined for that member in the outline is used. ). the formula may be too complicated to present as a simple formula. Here the calculation of Sales and “Net Sales” are calculated as a block. the method to calculate a member’s value may be conditional depending upon the value of another member. Notes Formula for other members may be included within a single calculation block. a calc member block structure is used.4 Calculation Script Commands Hyperion Essbase Calc Scripts Calc Member Blocks The previous chapter outlined two ways that members can be calculated in a calc script: Simply by specifying the member name followed by a semi-colon. 4-3 ... Do not leave spaces between the cross-dimensional operator and the member names..ELSE. Focusing Calculations Using Conditional Statements You can define formulas that use a conditional test or a series of conditional tests to control the flow of calculation. After you isolate this value..Endfix Using the FIX. More complex statements are built by providing additional actions if a test proves false. you can define a fixed range of members within a dimension... you do not want to calculate the entire database.. There are three ways to focus calculations: Using the FIX. The cross-dimensional formula is associated with a calc member block. The calc member block association is required when a crossdimensional operator is used on the left side of a formula..ENDFIX structure.. such as moving the value to February Actual Sales. a conditional statement directs that processing be performed only if a test proves true.). FIX. You type the cross-dimensional operator by following a hyphen (-) with a greater-than sign (>).ENDFIX structure Using conditional statements: IF. you can perform calculations on the value. you use a cross-dimensional operator to capture a value for January Actual Sales. Sales. Hyperion H H H Example SALES (SALES->BUDGET->JANUARY = SALES->ACTUAL->JANUARY. In other analytical situations. Focusing Calculations Using the Cross-Dimensional Operator The cross-dimensional operator (->) isolates data values for specific member combinations.ELSEIF..ENDIF Using the cross-dimensional operator (->) Focusing Calculations Using Fix.... you may want to use one set of parameters to calculate a portion of the database and a different set of parameters to calculate another portion. it isolates an area of the database to be calculated.Hyperion Essbase Calc Scripts Calculation Script Commands 4 Focusing Calculations In many analytical situations. In the simplest form..ENDFIX does not perform a calculation. For example. It is also available on the Calc Script Editor toolbar. In the Calc Script Editor. Command & Category Use Prefaces a substitution variable in a calculation script. Each command is also described. and a brief description of the command’s use. Calculates all or selected subsets of the database.). a calc script command is completed with a semicolon (.) Clears blocks of data and sets them to #MISSING Clears data values from the database and sets them to #MISSING. which category each is associated with. Calc Script commands can be selected using the Functions button on the toolbar.4 Calculation Script Commands Hyperion Essbase Calc Scripts Calc Script Commands Essbase provides a number of calc script commands to build and store calculation procedures. Copies a range of data cells to another range within the database. in detail. Calculates currency conversions (available if the optional Hyperion Essbase Currency Conversion product is installed. In general. Isolate a subset of the database for further processing. Declares one-dimensional array variables. in this chapter. Specific Calc Script commands are found in one of four categories: Data Declarations Control flow commands Functional Conditionals Summary of Calc Script Commands This table presents a summary of the available calc script commands. Calculates database values by simply consolidating the defined parent/child relationships and ignoring all member formulas. 4-4 H H H H AGG Functional ARRAY CALC Data Functional CCONV Functional CLEARBLOCK Functional CLEARDATA Functional DATACOPY Functional FIX/ENDFIX Control Hyperion . Hyperion Essbase Calc Scripts Calculation Script Commands 4 Command IF/ ELSE/ ELSEIF/ ENDIF LOOP/ ENDLOOP SET Category Conditional Use Perform Boolean (logical) tests before performing a calculation. Change the Essbase calculation environment during the execution of the Calc Script. Specifies the number of times to repeat a series of calculations. Declares a temporary variable containing a single value. Control Functional VAR Data Hyperion 4-5 . if the substitution variable &CurQtr has the value "Qtr1". becomes Qtr1. Hyperion Essbase treats any string that begins with a leading & as a substitution variable and substitutes these variables with their values before it parses the calculation script.The name of the substitution variable set on the database. variableName .4 Calculation Script Commands Hyperion Essbase Calc Scripts Detailed Description of Calc Script Commands & The & command prefaces a substitution variable in a calculation script. Syntax &variableName. 4-6 Hyperion . Example Usage &CurQtr. Calculate any members that are "leaf" members (that is. the formula is ignored and the result does not match the relationship defined by the database outline.Name of a single dimension or a comma-delimited list of sparse dimensions. Conversely. Syntax AGG (dimList). using the AGG command. Hyperion 4-7 . it simply consolidates parent/child relationships. Calculate all other members with formulas that have not been calculated yet.Market. it cannot calculate formulas. When a dimension contains fewer than six consolidation levels.Scenario). An AGG command ignores all member formulas. Notes The AGG command is used for a limited set of high-speed consolidations. AGG(Product. the CALC command is usually faster on dimensions with six or more levels.Hyperion Essbase Calc Scripts Calculation Script Commands 4 AGG The AGG command consolidates database values. level 0). The aggregation is based on the hierarchical relationship defined in the database outline. 2. 3. AGG follows the rules for any defined FIX command. Although AGG is faster than any of the CALC commands when calculating sparse dimensions. Aggregate the dimension. it can only perform aggregations based on the database structure. The AGG command aggregates a list of sparse dimensions. dimList . AGG is typically faster than CALC. If you want to aggregate a dimension that contains formulas: 1. If a member has a customized calculation defined in the outline. Example AGG(Market). Notes Typically. arrays are used to temporarily store variables as part of a member formula.4 Calculation Script Commands Hyperion Essbase Calc Scripts ARRAY The ARRAY command declares one-dimensional array variables. 4-8 Hyperion . 3. Example ARRAY discount[Scenario] = {1. As the member formula is processed. The size of the array variable is determined by the corresponding dimension (for example. one of 4 members (corresponding to the dimension Scenario.Dimension whose size determines the size of the array variable. arrayVariableName . with the values 1 through 4 entered in those four entries. You must surround the dimName with brackets [ ] when using the ARRAY command.Comma-delimited list of one or more array variable names. Syntax ARRAY arrayVariableName [dimName] = {constList}. then the array values are set to #MISSING. and called tmpProduct). 4}. each value in the array is assigned as its member is evaluated in the calculation. tmpProduct[Product]. ARRAY Discount[Period] has 12 members). The order of the values corresponds to the order of the members in the dimension used to define the array. and called discount) and one of 9 members (corresponding to dimension Product. You can calculate data for an array directly as part of a member formula. if dimension Period has 12 members. If no initialization is performed. dimName . Which yields an array of 4 entries. The variables are contained within the calc script and cease to exist after the calculation script ends.list of data values used to initialize the array variable(s). constList . 2. ARRAY discount[Scenario]. Which yields two arrays. CALC FIRST.Hyperion Essbase Calc Scripts Calculation Script Commands 4 CALC There are a number of variations of the CALC command. The description and syntax for the CALC commands are presented in three segments: CALC ALL CALC DIM CALC (others) Hyperion H H H The CALC ALL command allows for calculating the entire database. The remaining variations of the CALC command (CALC AVERAGE. Usually. and CALC TWOPASS) allow for calculation of members that have been assigned specific calculation characteristics. and the CALC command uses the outline consolidation formulas to calculate the remaining members. 4-9 . The CALC commands calculate all or selected subsets of the database. data is loaded into lower levels of the database. CALC LAST. CALC ALL Low Level data loaded The CALC DIM commands allows the user to specify the dimension(s) to be calculated. mbrList . Calculates all members.the exception list is a set of members.Comma-delimited list of members. Time. CALC ALL EXCEPT DIM(Product). Example CALC ALL. dimList .Defines an exception list of dimensions or members that are to be excluded from the calculation.the exception list is a set of dimensions. Syntax CALC ALL [EXCEPT DIM (dimList) | MBR (mbrList)]. except the Product dimension. member set functions.Comma-delimited list of dimensions. according to the consolidation definitions. EXCEPT . DIM . MBR . and user-defined dimensions) Dimension storage type (dense or sparse) Dimension order within the outline 4-10 H H H Hyperion . Calculates all members according to the consolidation definitions. Notes Calculation order is determined by: Type of dimension (Accounts.4 Calculation Script Commands Hyperion Essbase Calc Scripts CALC ALL The CALC ALL command calculates and aggregates the entire database based on consolidation attributes and member formulas in the database outline. The order in which dimensions are processed depends on the definitions of the various dimensions in the database outline. or range functions. Dense2). use separate CALC DIM commands (see Notes for efficiency concerns): CALC CALC CALC CALC DIM(Dense1). causes one pass through the database. Calc Dim (Accounts). Sparse2. DIM(Sparse2). dimList . The sparse dimensions are then calculated in the order in which they appear in dimList. Dense2. Each CALC DIM statement forces Essbase to make a pass through the database. To minimize the number of passes. Sparse1. All of the dense dimensions are calculated first.Sparse1. DIM(Dense2). in the order that the dense dimensions appear in dimList. Example CALC DIM(Dense1. DIM(Sparse1). Here.Sparse2. Calc Dim (Markets). the calculation order would be: Dense1.Accounts).Hyperion Essbase Calc Scripts Calculation Script Commands 4 CALC DIM CALC DIM calculates the formulas and consolidations associated with all members of all specified dimensions. causes two passes through the database. Syntax CALC DIM (dimList). Notes The order of calculations depends on whether dimensions are dense or sparse. list a series of dimensions in a single CALC DIM statement. If your dimensions need to be calculated in a particular order. Calc Dim (Markets.Single dimension or comma-delimited list of dimensions to be calculated. Hyperion 4-11 . 4-12 Hyperion . Accounts is calculated first. meaning that Markets are calculated before Accounts. it gives you greater control. no matter where it appears in the list. In the first example. the procedural flow-Markets then Accounts-is followed.4 Calculation Script Commands Hyperion Essbase Calc Scripts Although the second example causes two passes through the database. in the second example. The CALC LAST command calculates all members tagged in the database outline as time balance Last. Syntax CALC AVERAGE. Note These commands calculate the members based on the dimension tagged as accounts only. The CALC TWOPASS command calculates all members tagged in the database outline as two-pass. CALC FIRST. Hyperion 4-13 . All other member calculations are ignored during the processing of these commands. for example. The CALC AVERAGE command calculates all members tagged in the database outline as time balance Average or Average Non-Missing. CALC TWOPASS. it does not do a Time Series calculation on the dimension tagged as time.Hyperion Essbase Calc Scripts Calculation Script Commands 4 CALC (others) CALC DIM calculates the formulas and consolidations associated with all members of all specified dimensions. All other member calculations are ignored during this process. CALC LAST. The CALC FIRST command calculates all members tagged in the database outline as time balance First. curType . Syntax CCONV currExchMbr | TOLOCALRATE curType.Currency name containing the required exchange rate. Notes You convert data values from a local to a common. 4-14 Hyperion . Example CCONV YEN. French Francs and US$) to Japanese Yen using the YEN exchange rate from the currency database. local currency using the CCONV TOLOCALRATE curType command. currExchMbr . local rate. a member from the CurType dimension in the currency database.4 Calculation Script Commands Hyperion Essbase Calc Scripts CCONV CCONV calculates currency conversions. This is a member from the currency database. converted currency using the CCONV currExchMbr command. converts all the data values from local currency values (for example. This command is available only if your company has installed the optional Hyperion Essbase Currency Conversion product.Currency type.Converts a converted currency back to the original. converts all the data values back to the local currencies using the Act xchg currency type from the currency database. You can convert the data values back to the original. CCONV TOLOCALRATE "Act xchg". TOLOCALRATE . the UPPER option overwrites your data. Hyperion Essbase clears only the data cells within the fixed range. When a database is initially calculated. DYNAMIC .Clears all consolidated level blocks.Clears all data blocks. In this case. Syntax CLEARBLOCK ALL | UPPER | NONINPUT | DYNAMIC. Examples CLEARBLOCK ALL. and not the entire block. CLEARBLOCK UPPER. If you regularly enter data values directly into a consolidated level. CLEARBLOCK DYNAMIC. CLEARBLOCK clears blocks before a calculation occurs. numerous consolidated level sections (blocks) are created.Clears blocks containing values derived from calculations.Clears blocks containing values derived from Dynamic Calc And Store member combinations. CLEARBLOCK NONINPUT. you should use the NONINPUT option. UPPER . ALL .Hyperion Essbase Calc Scripts Calculation Script Commands 4 CLEARBLOCK The CLEARBLOCK command clears blocks of data and sets them to #MISSING. Hyperion 4-15 . NONINPUT . Notes CLEARBLOCK is especially useful when you want to optimize the calculation speed of a database. Subsequent calculations against the same set of data take longer since Hyperion Essbase must pass through these additional data blocks. If you use CLEARBLOCK within a FIX command. which only clears blocks that contains calculated values. Use CLEARBLOCK if you wish to clear blocks from the database. clears all Budget data. Notes CLEARDATA does not work if placed in an IF statement. select Database / Clear Data / ALL from the Application Manager main menu. To clear the entire database.Any valid single member name or member combination. 4-16 Hyperion . CLEARDATA can only clear a section of a database. mbrName . This command is useful when you need to clear existing data values before loading new values into a database. CLEARDATA Budget->Colas. even if all data values in a block are #MISSING.4 Calculation Script Commands Hyperion Essbase Calc Scripts CLEARDATA The CLEARDATA command clears data values from the database and sets them to #MISSING. Syntax CLEARDATA mbrName. It cannot clear the entire database. CLEARDATA does not clear blocks. clears only Budget data for the Colas product family. Examples CLEARDATA Budget. which can improve performance. or a function that returns a single member or member combination. Example DATACOPY Plan TO Revised_Plan. Hyperion 4-17 . Notes This command is useful when you must maintain an original set of data values and perform changes on the copied data set. or a function that returns a single member or member combination. then by default the same member or members from mbrName1 are assumed to exist in mbrName2 to complete the range. Any dimension explicitly represented in mbrName2 MUST be represented by another member of the same dimension in mbrName1.Any valid single member name or member combination. The size of the copied dimensions must be equal to the destination (TO) size. To reduce typing. if any dimension(s) represented by the members in mbrName1 are not represented in mbrName2. The reverse is not true. DATACOPY follows the rules for any defined FIX command.Hyperion Essbase Calc Scripts Calculation Script Commands 4 DATACOPY The DATACOPY command copies a range of data cells to another range within the database. mbrName2 . The ranges specified by both mbrName1 and mbrName2 must be of the same size. mbrName1. The same dimensions represented by the members that make up mbrName1 must also be present in mbrName2. Syntax DATACOPY mbrName1 TO mbrName2. Market). ENDFIX fixMbrs . fixMbrs can also contain: • AND/OR operators. Product and Market dimension for only the Budget scenario. FIX commands can be nested within other FIX command blocks. Notes All commands between FIX and ENDFIX are executed as a calculation unit. Data that does not pass the FIX test is not calculated and therefore is not brought into memory. Measures. When the FIX parameter references sparse dimensions. Product. FIX reduces I/O by evaluating data as it is brought into memory.A member name or a list of members from any number of database dimensions.) Member set functions that build member lists based on other members • 4-18 Hyperion . Commands encountered after ENDFIX are performed only when the calculation unit is completed.4 Calculation Script Commands Hyperion Essbase Calc Scripts FIX / ENDFIX The FIX structure is used to isolate a subset of the database. (Use the AND operator when all conditions must be met. FIX and ENDFIX do not require semicolons because they do not perform calculations.The commands that you want executed for the duration of the FIX Example FIX (Budget) CALC DIM (Year. ENDFIX This calculates Year. Syntax FIX (fixMbrs) Command(s). Measures. Use the OR operator when only one of several conditions must be met. Command(s) . ]] [ELSE statement5. statement6 .]] ENDIF) mbrName .Operations that are to be performed if the “IF” test returns a FALSE value and the “ELSEIF” test returns a TRUE value statement5.Operations that are to be performed if the “IF” test returns a TRUE value statement3.[statement2.Member with which the formula is associated conditions .Formula or function that returns a Boolean value of TRUE (a nonzero value) or FALSE (a zero value) statement1. statement2 .Operations that are to be performed if all conditional tests returns a FALSE value Hyperion 4-19 .[statement6. statement4 .] [ELSEIF(condition2) statement3.Hyperion Essbase Calc Scripts Calculation Script Commands 4 IF / ELSE / ELSEIF / ENDIF The IF conditional statements perform Boolean tests before performing a calculation.[statement4. Syntax mbrName (IF(condition1) statement1. 4 Calculation Script Commands Hyperion Essbase Calc Scripts Example Commission (IF(Sales > 200000) Commission = Sales * .12; ELSEIF (Sales >= 100000) Commission = Sales * .098; ELSE Commission = Sales * .05; ENDIF); If the value of sales is greater than 200,000, commission is calculated as 12% of Sales. Otherwise, if the value of sales is greater than 100,000, commission is calculated as 9.8% of Sales. Otherwise, commission is calculated as 5% of Sales. Notes When you use a conditional formula in a calc script, you must enclose it in parentheses and associate it with a member in the database outline. This is called a calc member block. The IF and ELSEIF statements introduce tests. When an IF test is true, the commands immediately following the test are executed, and control passes to ENDIF. If the test fails, execution falls to the ELSEIF test. If this test is true, the commands immediately following the ELSEIF are executed. Finally, all other circumstances are handled by the commands following the ELSE statement. You should not use a semicolon at the end of an IF command. If you use a semicolon, either an error occurs, or the progression of tests and commands does not execute as expected. Logical Operators Conditional statements are often made up using logical (comparison) operators. Valid logical operators include: > >= < <= == < > or != Is greater than. Is greater than or equal to. Is less than. Is less than or equal to. Is equal to. Is not equal to. 4-20 Hyperion Hyperion Essbase Calc Scripts Calculation Script Commands 4 Compound and complex logical tests can be created by using AND, OR and NOT: AND Logical AND linking operator for multiple value tests. Result is TRUE if both conditions are TRUE. Otherwise the result is FALSE. Logical OR linking operator for multiple value tests. Result is TRUE if either condition is TRUE. Otherwise the result is FALSE. Logical NOT operator. Result is TRUE if condition is FALSE. Result is FALSE if condition is TRUE.* OR NOT Example IF ((Sales > 100000) AND (Returns <= 5000) is true if the value of “Sales” exceeds 100,000 and the value of “Returns” does not exceed 5000. Hyperion 4-21 4 Calculation Script Commands Hyperion Essbase Calc Scripts LOOP/ENDLOOP The LOOP...ENDLOOP command block specifies the number of times to iterate calculations. All commands between the LOOP and ENDLOOP statements are performed the number of times that specified in the LOOP statement. Syntax LOOP (integer, [break]) Command(s); ENDLOOP integer - An integer constant that indicates the number of times to execute the commands contained in the loop block. break - parameter used to break the iterative process of a loop. break must be the name of a temporary variable (VAR). Setting the value of the variable to 1 during the execution of the loop causes the loop to break at the beginning of its next iteration. Command(s) - The commands that you want executed for the duration of the LOOP Notes LOOP is a block command that defines a series of commands for repeated execution. As with the FIX command, you can nest LOOP statements, if necessary. The ENDLOOP command ends a LOOP command block. It terminates the LOOP block and occurs after the commands in the LOOP block, but before any other commands. The use of LOOPs is a rare occurrence in Essbase Calculations. 4-22 Hyperion Hyperion Essbase Calc Scripts Calculation Script Commands 4 Example VAR Break = 0; CALC DIM(MEASURES); LOOP(10,BREAK) PROFIT = SALES - (PROFIT * .10); COMMISSIONS = PROFIT - SALES; PROFIT( IF ((PROFIT <> #MISSING) AND (@ABS(.10*PROFIT-COMMISSIONS) < .001)) BREAK = 1; ENDIF) ENDLOOP On the first line, the Break variable is set to 0. When tolerance reaches an appropriate point, you set Break to 1. The change causes looping to stop, even if the loop has not made its full 10 iterations. The solution of a simultaneous equation is contained in the loop structure. In the example, Profit is an unknown on both sides of the equation. The first equation, PROFIT = SALES - (PROFIT * 10) uses a substitution method to solve for Profit. A new value of profit is obtained by calculating commission on the old value of profit and subtracting it from sales. The second equation uses the new profit result of the first equation to calculate a new Commission. The conditional statement determines whether the absolute value of the difference of (10% of the new Profit) and Commission are within a tolerance of .001. If so, the “Break” variable is set to one, and this causes an exit of the loop before the next iteration. ✍ This is a simple example that illustrates the use of a Loop structure. It does not necessarily represent the best Calc Script solution for this particular problem. Hyperion 4-23 4 Calculation Script Commands Hyperion Essbase Calc Scripts SET Set commands allow the user to adjust the Essbase calculation environment during the execution of the Calc Script. There are a number of environmental parameters that can be set. SET commands in a calculation script are procedural. The first occurrence of a SET command in a calculation script stays in effect until the next occurrence of the same SET command. A description of each of the parameters for the Set command follows. 4-24 Hyperion Hyperion Essbase Calc Scripts Calculation Script Commands 4 SET AGGMISSG The SET AGGMISSG command specifies whether Hyperion Essbase aggregates #MISSING values in the database. Syntax SET AGGMISSG ON | OFF; Notes The default behavior of SET AGGMISSG is determined by the global setting for the database, as described in the Database Administrator's Guide. SET AGGMISSG commands apply to calculating sparse dimensions and not to aggregating. Hyperion 4-25 4 Calculation Script Commands Hyperion Essbase Calc Scripts SET CACHE The SET CACHE command specifies the size of the calculator cache. Syntax SET CACHE HIGH | DEFAULT | LOW | OFF | ALL; HIGH, DEFAULT, LOW - Levels defining the size of the calculator cache. You set the values of HIGH, DEFAULT and LOW in the essbase.cfg file. If you do not set the value of DEFAULT in the essbase.cfg file, Hyperion Essbase uses a default value of 200,000 bytes. The maximum calculator cache size that you can specify is 200,000,000 bytes. OFF - Hyperion Essbase does not use a calculator cache. ALL - Hyperion Essbase uses a calculator cache, even when you do not calculate at least one full sparse dimension. Hyperion Essbase uses the calculator cache to create and track data blocks during calculation. Using the calculator cache significantly improves your calculation performance. The size of the performance improvement depends on the configuration of your database. You can choose one of three levels. The size of the calculator cache at each level is defined using the CALCCACHE{HIGH | DEFAULT | LOW} settings in the essbase.cfg file. The level you choose depends on the amount of memory your system has available and the configuration of your database. You can specify whether, by default, Hyperion Essbase uses a calculator cache using the CALCCACHE TRUE | FALSE setting in the essbase.cfg file. By default CALCCACHE is set to TRUE. Hyperion Essbase uses the calculator cache providing that: • • Your database has at least two sparse dimensions. You calculate at least one, full sparse dimension (unless you specify the CALCCACHE ALL option). You can use this command more than once within a calculation script. 4-26 Hyperion Hyperion Essbase Calc Scripts Calculation Script Commands 4 SET CALCHASHTBL The SET CALCHASHTBL command optimizes the calculation of large, flat database outlines. Syntax SET CALCHASHTBL ON|OFF; Notes The default setting is OFF. You can change this setting using CALCOPTCALCHASHTBL=TRUE in the essbase.cfg file. When you enable this feature, Hyperion Essbase uses a hash table to optimize use of the calculator cache for large, flat databases. A large flat database is, for example, a database in which one or members has over 5000 children. Using this feature may significantly improve the performance of a CALC ALL of the database or CALC DIM of the dimension containing the member with over 5000 children. You can set the limit of the hash table using the CALCHASHTBLMEMORY setting in the essbase.cfg file. This feature has no effect if you are using parallel calculation. . Hyperion 4-27 4 Calculation Script Commands Hyperion Essbase Calc Scripts SET CALCPARALLEL SET CALCPARALLEL enables parallel calculation in place of the default serial calculation. Values 1-4 specifies parallel calculation with 1-4 threads. and the setting applies to all applications and databases on the Essbase OLAP Server. specifying the number of threads to be made available for parallel calculation. thus reducing opportunities for parallel calculation. dbname . If it is not. the setting applies to all databases in the specified application. 4-28 Hyperion . Values less than 0 return an error.An integer from 0-4. A number of features are affected by parallel calculation. you cannot specify a database. If you specify a value for dbname but do not include appname.Specifies that parallel calculation applies to all databases on the named application. 0. Notes Essbase analyzes each pass of a calculation to determine whether parallel calculation is possible. specifies serial calculation: no parallel calculation takes place. appname . The default value. Syntax SET CALCPARALLEL [appname [dbname]] n. This example enables up to three threads to be used to perform calculation tasks at the same time. Example SET CALCPARALLEL 3. If you specify a value for appname and do not specify a value for dbname. If your outline generates many empty tasks. If you do not specify an application. consider setting the CALCTASKDIMS configuration setting to increase the number of tasks and to decrease the size of each task identified for parallel calculation. the parameter is ignored and parallel calculation is enabled for all applications and databases on the OLAP Server.Specifies that parallel calculation applies only to the database named. n . Values greater than 4 are interpreted as 4. Essbase uses serial calculation even if CALCPARALLEL is set. Hyperion Essbase Calc Scripts Calculation Script Commands 4 Consider setting the value of CALCPARALLEL to one less than the number of available processors. For example you might want to set all applications to use serial calculation. Hyperion 4-29 . You can use SET CALCPARALLEL to override a CALCPARALLEL entry in the configuration file. This saves one processor for use either by the operating system or by the Essbase process that writes out dirty blocks from the calculator cache. but issue a calculation script command against a single application or database to use parallel calculation. Notes Because each unique combination of members from the selected sparse dimensions is a potential task. for example. dbname . Example SET CALCTASKDIMS Sample Basic 2. and parallel calculation is enabled for all applications and databases on the OLAP Server. the parameter is ignored. If you do not specify an application. Syntax SET CALCTASKDIMS [appname [dbname]] n. A value greater than the number of sparse dimensions in the outline is interpreted as the largest valid value. 4-30 Hyperion . n . The default value. If you specify a value for appname and do not specify a value for dbname. the last two sparse dimensions in the outline will be used to identify potential tasks to be performed at the same time during a calculation pass. appname . indicates that the last and second-to-last sparse dimensions in the outline are used. the potential number of parallel tasks is the product of the number of members of the selected dimensions.4 Calculation Script Commands Hyperion Essbase Calc Scripts SET CALCTASKDIMS SET CALCTASKDIMS specifies how many of the sparse dimensions in an outline are used to identify potential tasks that can be run in parallel.An integer specifying the number of sparse dimensions to be included when Essbase identifies tasks that can be performed at the same time. Essbase issues an error if the value is less than 1. If you specify a value for dbname but do not include appname. the setting applies to all databases in the specified application. A value of 2.Specifies that SET CALCTASKDIMS applies only to the database named. you cannot specify a database. This example specifies that for application Sample and database Basic.Specifies that SET CALCTASKDIMS applies to all databases on the named application. and the setting applies to all applications and databases on the Essbase OLAP Server. indicates that only the last sparse dimension in the outline will be used to identify tasks. The maximum value is the number of sparse dimensions in the outline. 1. Hyperion Essbase Calc Scripts Calculation Script Commands 4 Using the calculator bitmap cache can affect this value. Use this configuration setting only if your outline generates many empty tasks. You can use SET CALCTASKDIMS to override a CALCTASKDIMS entry in the configuration file. For example you might want to set all applications to use a single dimension for parallel calculation. If you do not notice an improvement in performance after raising the value of CALCTASKDIMS. but issue a calculation script command against a single application or database to use two dimensions. Sometimes using more task dimensions can generate such a large number of tasks that performance may decrease instead of increase. Hyperion 4-31 . consider returning it to its default value of 1. because the overhead of generating and managing the tasks is too great. thus reducing opportunities for parallel calculation. even on a default calculation (CALC ALL. It calculates these dirty blocks based on the Product dimension and marks them as clean.) of your database. ONLY .Hyperion Essbase marks the specified data blocks as clean but does not actually calculate the data blocks. The existing clean or dirty status of the calculated data blocks remains unchanged. Hyperion Essbase will not recalculate the data block on subsequent calculations.Hyperion Essbase marks calculated data blocks as clean. Input blocks as clean. because they are not calculated. AFTER . Hyperion Essbase does not mark the child. When a data block is clean. SET CLEARUPDATESTATUS AFTER. When Hyperion Essbase does a full calculation of your database. but disables calculation. OFF . Hyperion Essbase searches for dirty parent data blocks for New York (for example "New York"->Colas in which Colas is a parent member). ENDFIX New York is a member on the sparse Market dimension. FIX ("New York") CALC DIM(Product). Data blocks are not marked as clean. Syntax SET CLEARUPDATESTATUS AFTER | ONLY | OFF.Hyperion Essbase does not mark the calculated data blocks as clean. They assume that intelligent calculation is turned on (the default).4 Calculation Script Commands Hyperion Essbase Calc Scripts SET CLEARUPDATESTATUS SET CLEARUPDATESTATUS specifies when Hyperion Essbase marks data blocks as clean. it marks the calculated data blocks as clean. Example The following examples are based on the Sample Basic database. even if you are calculating a subset of your database. Notes This clean status is used during intelligent calculation. The data blocks in your database have a calculation status of either clean or dirty. 4-32 Hyperion . This does the same as AFTER. provided that intelligent calculation is turned on. If you do not use SET CLEARUPDATESTATUS. consider carefully the effect of the SET CLEARUPDATESTATUS AFTER command on your calculation. However. Hyperion Essbase does not mark calculated data blocks as clean when you calculate a subset of your database. If you calculate a subset of your database. Hyperion Essbase marks data blocks as clean only on a full calculation (CALC ALL. consider carefully the effect of this command on your calculation to ensure that your calculation results are correct. Hyperion 4-33 .) or when Hyperion Essbase calculates all members in a single calculation pass through your database.Hyperion Essbase Calc Scripts Calculation Script Commands 4 To ensure the accuracy of your calculation results. you may want to use the SET CLEARUPDATESTATUS AFTER command to ensure that the calculated blocks are marked as clean. Syntax SET FRMLBOTTOMUP ON|OFF. You can change this setting by using CALCOPTFRMLBOTTOMUP TRUE in the essbase. This command tells Hyperion Essbase to perform a bottom-up calculation on formulas that would otherwise require a top-down calculation. This command optimizes the calculation of complex formulas on sparse dimensions in large database outlines. commands to calculate the database. 4-34 Hyperion .cfg file. You might want to turn on this setting when using the CALC ALL. be sure to check the validity of calculation results produced when the command is enabled (set to ON). and CALC DIM.4 Calculation Script Commands Hyperion Essbase Calc Scripts SET FRMLBOTTOMUP The SET FRMLBOTTOMUP command optimizes the calculation of complex formulas on sparse dimensions in large database outlines. range functions) The formula's dependencies are not straightforward Before using the SET FRMLBOTTOMUP command in a production environment. Example Notes The default setting is OFF. Forcing a bottom-up calculation on a formula may produce results that are inconsistent with a top-down calculation if: • • The formula contains complex functions (for example. Syntax SET LOCKBLOCK HIGH | DEFAULT | LOW. LOW .Levels defining the number of blocks that Hyperion Essbase can address concurrently. However. DEFAULT. you may want to set a number higher than 100 if you are consolidating very large numbers of children in a formula calculation. Hyperion Essbase locks the block along with the blocks containing its children. The number of blocks that can Hyperion Essbase can address at each level is defined using the CALCLOCKBLOCK setting in the essbase. By default Hyperion Essbase allows up to 100 blocks to be locked (addressable) concurrently when calculating a block. This setting ensures that Hyperion Essbase can address all the required blocks when calculating a data block and that performance will not be impaired. Hyperion Essbase calculates the block and then releases it along with the blocks containing its children. HIGH. When a block is calculated. This is sufficient for most database calculations. Notes You can choose one of three levels.Hyperion Essbase Calc Scripts Calculation Script Commands 4 SET LOCKBLOCK The SET LOCKBLOCK command specifies the maximum number of blocks that Hyperion Essbase can address concurrently when calculating a sparse member formula. Hyperion 4-35 .cfg file. WARNS .Displays only error messages. and error messages. INFO .Instructs Essbase to perform a simulated calculation only. Notes The SET MSG command applies only to the calculation script in which it is used. SUMMARY . 4-36 Hyperion . Syntax SET MSG SUMMARY | DETAIL | ERROR | WARNS | INFO | NONE | ONLY. However. ERROR .4 Calculation Script Commands Hyperion Essbase Calc Scripts SET MSG The SET MSG command indicates the level of messaging that you wish to receive / review during your calculations. SET MSG DETAIL is useful for testing your database's consolidation path. because error messages may contain vital information.Provides the same information as SUMMARY. In addition.Displays no messages during the life of the calculation script. SET MSG SUMMARY causes a processing overhead of approximately 1% to 5%. and written Data cells calculated DETAIL .Displays calculation settings and provides statistics on the number of: • • Data blocks created. they are still displayed.Displays only warning and error messages. It causes a high processing overhead and therefore should be used during test calculations only. ONLY . it displays a detailed information message every time Hyperion Essbase calculates a data block. read. warning. NONE . You may disregard any error message during validation that indicates Essbase does not recognize command.Displays information. depending on the database size. Hyperion Essbase measures the interval by taking the number of data blocks already calculated as a percentage of the total number of possible data blocks in your database. LOW . 6000. the interval between completion notices is very approximate. which provides 10 completion messages at 10% intervals during the calculation. then Hyperion Essbase displays only two notices. For example.cfg file. The interval between notices is approximate. For partial calculations and calculations with multiple passes through your database.000 . 4000. Completion notices do not significantly reduce the calculation performance. If you do not set the value of DEFAULT in the essbase. You can specify the number of notices for each level using the CALCNOTICE setting in the essbase.000 possible blocks and you specify 5 notices. Syntax SET NOTICE HIGH | DEFAULT | LOW. and LOW using the CALCNOTICE setting in the essbase. Hyperion Essbase uses a default value of 10. except when used with a very small database. Notes You can set the values of HIGH.000.cfg file. DEFAULT. Hyperion 4-37 . DEFAULT. if only the blocks 1.000 exist.000 and 10.Hyperion Essbase Calc Scripts Calculation Script Commands 4 SET NOTICE The SET NOTICE command monitors the progress of your calculation by providing completion notices at intervals during the calculation. HIGH. 8. However.Levels defining the frequency and number of completion notices.cfg file. if there are 10. Hyperion Essbase notifies you when the calculation approximately reaches block 2000.4. displays 20 completion notices at 5% intervals. displays 5 completion notices at 20% intervals. displays 50 completion notices at 2% intervals. 4-38 Hyperion . in the calc script: SET NOTICE HIGH.cfg file contains the following settings: CALCNOTICEHIGH 50 CALCNOTICEDEFAULT 20 CALCNOTICELOW 5 then. SET NOTICE DEFAULT.4 Calculation Script Commands Hyperion Essbase Calc Scripts Example If the essbase. SET NOTICE LOW. ON . regardless of whether they have been updated. If a data block is clean.Hyperion Essbase calculates only blocks marked as dirty OFF . all data blocks are marked as clean after a full calculation of the database but not after a partial calculation of the database. Syntax SET UPDATECALC ON | OFF. such as updated data blocks and their dependent parents. If required. you can change this default behavior using the SET CLEARUPDATESTATUS command in your calculation script. the calculation is very efficient.Hyperion Essbase Calc Scripts Calculation Script Commands 4 SET UPDATECALC The SET UPDATECALC command turns intelligent calculation on and off. By default. Hyperion 4-39 . Notes Using intelligent calculation. Hyperion Essbase calculates only dirty blocks. All data blocks in the database are marked as either clean or dirty.Hyperion Essbase calculates all data blocks. Therefore. then Hyperion Essbase knows that the block does not need to be recalculated. The following database outline example illustrates this situation: If you want to consolidate values above this level. because Europe also contains countries that use other currencies. all children of France. consolidate to France. and Avignon. Therefore.4 Calculation Script Commands Hyperion Essbase Calc Scripts SET UPTOLOCAL The SET UPTOLOCAL command restricts consolidations to those parents with the same defined currency. such as the cities Paris. all cities in France use the franc (FF) as the unit of currency. Consolidation stops at this level. Notes The default is OFF. For example. Nancy. however. Syntax SET UPTOLOCAL ON | OFF. SET UPTOLOCAL ON has no effect on databases with no currency definitions. 4-40 Hyperion . you must use CCONV to convert the values to a master rate before consolidating. “Break2“. it is set to #MISSING. Syntax VAR varName [= value]. Notes You can also use a single VAR command to declare multiple variables by supplying a comma-delimited list of variable names. VAR commands can only be assigned values within a member calculation or when VAR is declared. The name of the variable cannot duplicate a database member name. If a value is not declared. Break2. varName . Break3. Declares a variable “Target” and initializes it to 1200.parameter that declares the data value.Hyperion Essbase Calc Scripts Calculation Script Commands 4 VAR The VAR command declares a temporary variable that contains a single value. “Break3“and initializes them to #Missing. value .Name of the temporary variable. Example VAR Target = 1200. Hyperion 4-41 . VAR Break1. Declares three variables “Break1”. and Jan 1999. run the CSFix calc script. you may see an Essbase message alerting you to unknown member names. Buffalo. The Sales are increased by 15%. Close the spreadsheet.xls 1) 2) From Essbase Application Manager. create a new calc script that changes Budget Sales values for the Albany and Buffalo markets for Jan 1999.4 Calculation Script Commands Hyperion Essbase Calc Scripts Exercise 4-1: Focus Calculations using Fix / EndFix In this exercise. Increase their sales by 15%. Ensure that the differences between the Essbase calculated sales and the spreadsheet calculated sales are zero. Lock and send the data in the Lock&Send sheet to the HLandS1 database. From the Calc&Retrieve sheet. view the application log. Save the calc script. Verify that the database calculated only the sales values for Albany. you use the FIX command to create a calc script to change sales values in the Budget scenario for the Albany and Buffalo markets for Jan 1999. Formulas are included within the Calc&Retrieve sheet to assist you. calling it CSFix. Then set your global options to not display unknown member names. Open the SS_Fix spreadsheet. Budget. From Essbase Application Manager. 3) 4) 5) ✍ 6) 7) 8) 4-42 Hyperion . clear all data from the HLandS1 database. Select No to suppress additional messages. Note: Because this is a custom spreadsheet designed for the exercise. Perform a retrieval and notice the calculation results. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSFix SS_Fix. Using the FIX command. For this exercise. the commission should be 8% of sales. Save the calc script as CSIF. Open the SS_IF spreadsheet. Close the spreadsheet. Save the calc script as CSIF.xls 1) From Essbase Application Manager. Add a block to calculate the commission. Perform a retrieval and notice the calculation results. Ensure that the commission is being calculated correctly. From the Calc&Retrieve sheet. If not. Open the CSDemo calc script.Hyperion Essbase Calc Scripts Calculation Script Commands 4 Exercise 4-2: Focus Calculations using If / Else / Endif In this exercise. you use the following files: Database Calc Script Calc Script (new) Spreadsheet CALC:HLandS1 CSDemo CSIF SS_IF. For this exercise. the commission is 10% of sales. 2) 3) 4) 5) 6) 7) 8) 9) Hyperion 4-43 . If margin percent is greater than 15 percent. If margin percent is less than or equal to 15%. run the CSIF calc script. If margin percent is less than or equal to 15%. you use an IF statement to calculate commission based on margin percent. the commission should be 10% of sales. Remove the line that does the variance calculation. Lock and send the data in the Lock&Send sheet into the HLandS1 database. Use an IF statement to calculate commission based on margin percent. clear all data from the HLandS1 database. the commission is 8% of sales. revise the calc script and rerun the calculation. If margin percent is greater than 15%. run the CSXDim calc script. Create a new calc script that uses cross-dimensional operators within a calc script to calculate Budget Sales for Feb 1999 as a 10% increase on the Jan 1999 Budget Sales values. you use cross-dimensional operators within a calc script to calculate Budget Sales for Feb 1999 as a 10% increase of the Jan 1999 Budget Sales values.xls 1) 2) From Essbase Application Manager. Perform a retrieval and notice the calculation results. Save the calc script. clear all data from the HLandS1 database. Spreadsheet calculations are included in the Calc&Retrieve sheet to facilitate data verification. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSXDim SS_X_Dim. Open the SS_X_Dim spreadsheet. Ensure that the "Excel Calculation" results are identical to the "Feb 1999" results. For this exercise. calling it CSXDim. 3) 4) 5) 6) 7) 4-44 Hyperion .4 Calculation Script Commands Hyperion Essbase Calc Scripts Exercise 4-3: Focus Calculations using Cross-Dimensional Operators In this exercise. Lock and send the data in the Lock&Send sheet into the HLandS1 database. From the Calc&Retrieve sheet. Ensure that Feb 1999 sales values are calculated correctly. Close the spreadsheet. ... These include the CALC. CLEARBLOCK. There are four categories of Calc Script commands: Data Declarations Control flow commands Functional Conditionals Hyperion H H H H Data Declaration commands are used to declare. while the LOOP…ENDLOOP command allows you to repeat a command as necessary. and test conditions and calculate a formula based on the success or failure of the test.. CLEARDATA and DATACOPY commands.. Control Flow commands are used to iterate a set of commands or to restrict the commands' effect to a specified subset (partition) database.Hyperion Essbase Calc Scripts Calculation Script Commands 4 Unit Summary Calc member blocks treat a series of member computations as single block of calculations. 4-45 .. Essbase provides a number of commands that are used to create calculation scripts. Conditional commands let you to control which formulas are executed within a given member calculation. which allow you to define the calculation environment parameters.ELSEIF. Also included in the Functional commands are the SET commands. Examples are ARRAY and VAR.ELSE.ENDIF structure Functional commands allow you to consolidate an entire database or focus on a single dimension or a single member. These commands are composed of the IF. and set the initial values of. temporary variables. The FIX…ENDFIX command can be used to restrict a calculation to a particular member or members. Functional or Conditional) Command VAR FIX IF CALC SET Command Type 4-46 Hyperion .4 Calculation Script Commands þ Check Your Understanding 1) Hyperion Essbase Calc Scripts Now that you have completed the chapter. check your understanding by responding to the following questions: For each of the following commands. identify the type of command (Data Declaration. Control flow. identify the type of command (Data Declaration.Hyperion Essbase Calc Scripts Calculation Script Commands 4 þ Check Your Understanding Solutions 1) For each of the following commands. Functional or Conditional) Command VAR FIX IF CALC SET Command Type Data Declaration Control flow Conditional Functional Functional Hyperion 4-47 . Control flow. 4 Calculation Script Commands Hyperion Essbase Calc Scripts 4-48 Hyperion . 5 Math Functions Chapter Objectives By the end of this chapter. you will be able to: • • Describe and demonstrate mathematical functions used in Calc Scripts Apply these mathematical functions to a series of incremental exercises . These functions return a numeric result that is based on supplied member values. use Essbase functions rather than formulas where possible. Hyperion .5 Math Functions Hyperion Essbase Calc Scripts Transforming Values with Math Functions The mathematical functions used in calc scripts include many of the standard mathematical operations. ✍ More complicated mathematically oriented functions are available in the Statistical Functions and in the Range (and Financial) Functions. Limiting scripts to Essbase functions ensures that all calc scripts use the same method. thus promoting consistency of data across the application. such as: absolute values rounding. truncation variance calculation factorial 5-2 H H H H H H H H More complicated arithmetic operations. such as: logarithms and exponentiation modulus arithmetic Those that perform operations on lists. such as: summation and averaging selecting maximum or minimum value When performing statistical and financial manipulations. Math functions can be broken into three basic categories: Simple arithmetic operations. this parameter indicates how missing and zero values are to be processed. Used in conjunction with an expList. functions. in this chapter. The factorial of number.Ignores all #MISSING values SKIPZERO . The natural logarithm (base e).Ignores all 0 values SKIPBOTH . Comma-delimited list of members.Ignores all 0 and #MISSING values mbrName1. The maximum value all values in a list. mbrName2 expList SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH Summary of Math Functions This table summarizes the Math Functions. The base-10 logarithm. The value of e (the base of natural logarithms) raised to a power. The next lowest integer value of number. @MAXS enables skipping of #MISSING and 0 values. SKIPNONE . The maximum value all values in a list. Each function is also described. The logarithm calculation to a specified base. The average of all values in a list. and numeric expressions. Members from the same dimension whose results are to be calculated.Includes in the operation all values specified in expList regardless of their content SKIPMISSING . Function @ABS @AVG @EXP Used to calculate The absolute value of number. variable names. @FACTORIAL @INT @LN @LOG @LOG10 @MAX @MAXS Hyperion 5-3 .Hyperion Essbase Calc Scripts Math Functions 5 Math Function Parameters There are common parameters associated with the various math functions: expression Member name or mathematical expression that generates a numeric value. all of which return numeric values. in detail. The summation of all the values in a list. The integer portion of expression. @MINS enables skipping of #MISSING and 0 values. The modulus of a division operation of mbrName1 divided by mbrName2.5 Math Functions Hyperion Essbase Calc Scripts Function @MIN @MINS Used to calculate The minimum value all values in a list. The value rounded to a specified number of digits. The modulus is the remainder for an integer quotient. The difference between two values. The value of the decimal portion of expression. The minimum value all values in a list. The value of the specified expression raised to power. The percent difference between two values. @MOD @POWER @REMAINDER @ROUND @SUM @TRUNCATE @VAR @VARPER 5-4 Hyperion . Whether the resulting tolerance is negative or positive is unimportant in this test.4 0.8 5. Hyperion 5-5 .3 -0. you are testing the result of a simultaneous equation.3 6.Hyperion Essbase Calc Scripts Math Functions 5 Detailed Description of Math Functions @ABS @ABS returns the magnitude of the expression as a positive number.7 5. This yields the following result: Value 6.4 -0.3 -6. Syntax @ABS (expression) In some cases. you perform a test that yields either a positive or a negative value.8 Abs 6.3 0.8 Usage A common use of @ABS is to test for tolerances. Example ABS = @ABS(Value).8 5. when the only important factor is the magnitude of the number itself.7 -5. In the example. 8 Diet Cola 145 150 #MI 170 #MI 93 5-6 Hyperion .5 Math Functions Hyperion Essbase Calc Scripts @AVG The @AVG() function calculates and returns the average of all values in a list.California:Nevada). expList) Example West=@AVG(SKIPNONE. This example produces the following results: Cola California Oregon Washington Utah Nevada West 678 160 130 130 76 234. Syntax @AVG (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. 5 -0. the value of e (the base of natural logarithms) raised to the power of the specified expression. Hyperion 5-7 . Syntax @EXP (expression) Example The following example is based on a variation of Sample Basic: EXP = @EXP(Value).6 1 0.6 36. Essbase returns #MISSING.648721 0. This example produces the following results: Value 10.7 3.5 EXP 44355.606531 Note If the expression is less than -700 or greater than 700.59823 2.718282 1.Hyperion Essbase Calc Scripts Math Functions 5 @EXP The @EXP() function returns the exponent of a specified expression. that is. 5-8 Hyperion .* number. Syntax @FACTORIAL(expression) Examples Fact = @FACTORIAL(Value).6 1 0.5 Fact 362880 36.59823 1 1 #Missing Notes If the expression is larger than 189 or less than zero.. Essbase returns #MISSING.5 -0.. This example produces the following results: Value 10. If the expression is non-integer. The factorial of a number is equal to 1*2*3*.7 3.5 Math Functions Hyperion Essbase Calc Scripts @FACTORIAL The @FACTORIAL() function returns the factorial of expression. Essbase calculates the factorial value for the integer portion of the expression. 3 -6.4 -0.7 -5.Hyperion Essbase Calc Scripts Math Functions 5 @INT The @INT() function returns the next lowest integer value of expression.3 -0. This yields the following result: Value 6.8 5.8 Int 6 5 -1 -1 -6 -7 Hyperion 5-9 . Syntax @INT (expression) Example Int = @INT(Value). The @LOG() function returns the logarithm (for the specified base) of the specified expression. If the value of base is #MISSING. 5-10 Hyperion . or numeric expression. 2).643856 9. member combination.Single member specification.965784 #Missing #Missing Notes If expression less than or equal to 0. Syntax @LN (expression) @LOG10 (expression) @LOG (expression. @LOG(Sales) is equivalent to @LOG10(Sales). @LOG10 The @LN. less than or equal to 0. LOG_val = @LOG(Value. If the base is omitted.907755 #Missing #Missing LOG10_val -1 2 3 #Missing #Missing LOG_val -3.30259 4. Essbase calculates the base-10 logarithm of the specified expression. [base]) base (optional for LOG() function) .60517 6.5 Math Functions Hyperion Essbase Calc Scripts @LN.32193 6. LOG10_val = @LOG10(Value). or close to 1. the @Log() function returns #MISSING. @LOG. This example produces the following result: Value .1 100 1000 0 -10 LN_val -2. @LOG and @LOG10 functions are used to calculate and return logarithm values. The @LOG10() function returns the logarithm (base 10) of the specified expression. Example LN_val = @LN(Value). The @LN() function returns the natural logarithm (base e) of the specified expression. Essbase returns #MISSING. Qtr1_Min = @MIN(Jan:Mar). Sales Jan Feb Mar Qtr1_Max Qtr1_MaxS_Both Qtr1_MaxS_None Qtr1_Min Qtr1_MinS_Both Qtr1_MinS_None 500 0 700 700 700 700 0 500 0 COGS #Missing 1500 2300 2300 2300 2300 #Missing 1500 #Missing Other -500 -350 0 0 -350 0 -500 -500 -500 Hyperion 5-11 . @MAXS. The @MAXS and MINS functions permit skipping of #MISSING and 0 values. expList) Examples Qtr1_Max = @MAX(Jan:Mar). Qtr1_MaxS_None = @MAXS(SKIPNONE. @MIN and @MINS are used to find the maximum and minimum values of a range. Jan:Mar).Hyperion Essbase Calc Scripts Math Functions 5 @MAX. @MAXS. Qtr1_MinS_None = @MINS(SKIPNONE. Jan:Mar). Jan:Mar). Jan:Mar). Qtr1_MaxS_Both = @MAXS(SKIPBOTH. Qtr1_MinS_Both = @MINS(SKIPBOTH. expList) @MIN (expList) @MINS (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. @MIN and @MINS @MAX. Syntax @MAX (expList) @MAXS (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. 3 -2.1 -2.1 5-12 Hyperion .8 5.4 2.3 5.8 0.8 6.3 -5. The modulus is produced by dividing mbrName1 by mbrName2.3 divisor 3 3.2 Mod 0.2 3 3. divisor). The modulus is the remainder for an integer quotient.5 Math Functions Hyperion Essbase Calc Scripts @MOD @MOD function calculates the modulus (the remainder) of a division operation. mbrName2) Example Mod = @MOD(Value. This example produces the following results: Value 6.3 -5.3 2. Syntax @MOD (mbrName1.2 3 3. function. or other numeric expression. variable name.Single member specification. 8) = 256 Notes If expression is negative. Examples @POWER(14. If the value calculated by @POWER is an infinite number. Essbase returns #MISSING.Hyperion Essbase Calc Scripts Math Functions 5 @POWER The @POWER() function returns the value of the specified member or expression raised to power. Syntax @POWER (expression. 3) = 2744 @POWER (2. and if power is not an integer. Hyperion 5-13 . power) power . Essbase returns #MISSING. This example produces the following results: Value 6.8 5.7 -5.4 -0.3 -0.3 -0. Syntax @REMAINDER (expression) Example Remain = @REMAINDER(Value).3 -6.3 -0.8 5-14 Hyperion .5 Math Functions Hyperion Essbase Calc Scripts @REMAINDER The @REMAINDER() function returns the value the decimal portion of the expression.7 -0.4 -0.8 0.8 Remain 0. an expression is rounded to the nearest integer.71 -5.42 -0. [numDigits]) numDigits [optional] .32544 -0.82145 5. Round2 = @ROUND(Value. Its default value is 0.Hyperion Essbase Calc Scripts Math Functions 5 @ROUND @ROUND rounds expressions as indicated by the numDigits parameter.70688 -5.31234 -6. A negative value for numDigits rounds an expression to a power of 10. This yields the following results: Value 6. an expression is rounded to the specified number of decimal places. 2).81 Hyperion 5-15 .Single-member specification.80988 Round 7 5 0 -1 -5 -7 Round2 6. Example Round = @ROUND(Value). If numDigits is greater than 0. variable name. @ROUND also acts as a scaling factor. If numDigits is 0.82 5. In this way.33 -0. Syntax @ROUND (expression.31 -6.42135 -0. or other numeric expression that provides an integer value. 5 Math Functions Hyperion Essbase Calc Scripts @SUM The @SUM() function returns the summation of all the values in a list. This example produces the following results: Cola California Oregon Washington Utah Nevada West 678 160 130 130 76 1174 Diet Cola 145 150 #MI 170 #MI 465 5-16 Hyperion . Syntax @SUM (expList) Example West = @SUM(California:Nevada). Syntax @TRUNCATE (expression) Example Trunc = @TRUNCATE(Value).80988 Trunc 6 5 0 0 -5 -6 Hyperion 5-17 .32544 -0.70688 -5.31234 -6.Hyperion Essbase Calc Scripts Math Functions 5 @TRUNCATE @TRUNCATE returns only the integer portion of an expression.82145 5.42135 -0. This yields the following results: Value 6. 80988 -5.32544 -5.5 Math Functions Hyperion Essbase Calc Scripts @VAR @VAR presents the difference between the values of two members. unless an account is tagged as "Expense".32544 6.49601 1. Syntax @VAR (member1. The variance (@VAR) is derived by subtracting mbrName2 values from mbrName1.49754 5-18 Hyperion .49754 -1.80988 Value2 5.82145 -6.49601 -1. This function considers accounts that are tagged in the database outline as Expense and accounts tagged as No Expense and calculates the variance accordingly. in which case mbrName1 values are subtracted from mbrName2. member2) Example Variance=@VAR(Value1.31234 Variance 1. Value2). This yields the following results (assuming Value1 and Value2 do not represent “Expense Accounts”): Value1 6.82145 5.31234 -6. 09176 -21.80988 -5.32544 -5.1898 Hyperion 5-19 .32544 6.31234 Variance % 28.82145 -6.99065 -28. This function considers accounts that are tagged in the database outline as Expense and accounts tagged as No Expense and calculates the variance accordingly. member2) Example “Variance %”=@VARPER(Value1.31234 -6.82145 5. The percent variance (@VARPER) is derived by subtracting the percent value of member2 from the percent value member1. Value2). Syntax @VARPER (member1. unless an account is tagged as Expense in which case the member1 percent value is subtracted from the member2 percent value.931 21.80988 Value2 5.Hyperion Essbase Calc Scripts Math Functions 5 @VARPER The @VARPER function returns the percent difference between the values of two members. This yields the following results (assuming Value1 and Value2 do not represent “Expense Accounts”): Value1 6. For level-1 market members (states). Use the @AVG function. Lock and send the data in the Lock&Send sheet to the HLandS1 database. Ensure that the commission is calculated correctly. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSMath SS_Math. Perform a retrieval and note the calculation results. clear all data from your HLandS1 database. Close the CSMath spreadsheet. For this exercise. The value is to be rounded to two decimals. run the CSMath calc script. In this exercise. Open the SS_Math spreadsheet. revise the calc script and rerun the calculation. If not.xls 1) 2) From Essbase Application Manager. and use the @ROUND function to round the calculated values to two decimal places.5 Math Functions Hyperion Essbase Calc Scripts Exercise 5-1: Using Math Functions For level-0 market members (cities). Save the new script as CSMath. the “Average Sales” member stores the average of the sales for the cities of a state. the “Average Sales” for Connecticut is the total sales for Connecticut divided by the number of cities in Connecticut. the “Average Sales” member stores the total sales for that city. For example. From the Calc&Retrieve sheet. 3) 4) 5) 6) 7) 8) 5-20 Hyperion . you use the @ROUND and @AVG functions within a calc script to calculate Connecticut’s “Average Sales”. Create a new calc script to calculate the “Average Sales” for Connecticut to represent the average amount of sales in the cities in Connecticut. Hyperion Essbase Calc Scripts Math Functions 5 Unit Summary A wide range of mathematical functions is available for the creation of calc scripts. such as: summation and averaging selecting maximum or minimum value To promote consistency throughout an application. such as: absolute values rounding. 5-21 . use the Essbase functions rather than creating your own formulas. truncation variance calculation factorial Hyperion H H H H H H H H There are more complicated arithmetic operations. These include simple arithmetic operations. such as: logarithms and exponentiation modulus arithmetic There are also math functions that perform operations on lists. excluding #MISSING and 0 values. identify the Math function that you apply. 5-22 Hyperion . Calculate the total of a series of values. check your understanding by responding to the following questions: For each of the following situations. Compute the average of a collection of values. Find the remainder when one number is divided by another to produce an integer quotient. What is the value of the next lowest integer to number? Determine the minimum value in a list.5 Math Functions þ Check Your Understanding 1) Hyperion Essbase Calc Scripts Now that you have completed the chapter. Calculate the total of a series of values.Hyperion Essbase Calc Scripts Math Functions 5 þ Check Your Understanding Solutions 1) For each of the following situations. @SUM @AVG @INT @MINS @MOD Hyperion 5-23 . excluding #MISSING and 0 values. What is the value of the next lowest integer to number? Determine the minimum value in a list. identify the Math function that you apply. Find the remainder when one number is divided by another to produce an integer quotient. Compute the average of a collection of values. 5 Math Functions Hyperion Essbase Calc Scripts 5-24 Hyperion . 6 Boolean Functions Chapter Objectives By the end of this chapter. you will be able to: • • Describe and demonstrate the use of Boolean functions to test values in a Calc Script Practice using boolean functions to a series of incremental exercises . For example. New York. and Chicago. When a boolean function begins with @ISI. For example. Essbase provides three logical connectors for compound logical tests: AND. The determination is based on the characteristics of the current member combination. and @ISIDESC(EAST) includes East. When a boolean function has a related “@ISI” function. Not all tests can be performed with a single condition. Boolean functions are usually used within conditional statements. Boston. or range functions Name of the specified dimension dimName 6-2 Hyperion . Boolean Function Parameters There are common parameters associated with the various boolean functions: mbrName mbrList rangeList Single-member specification Comma-delimited list of members Colon-delimited range of members.6 Boolean Functions Hyperion Essbase Calc Scripts Testing for Values Using Boolean Functions A Boolean function returns a value of TRUE (1) or FALSE (0). and Chicago. @ISDESC(EAST) includes New York. member set functions. Boston. the TRUE test includes the member specified in the parameter list. the detailed description section of this chapter presents them together. OR. and NOT. you may want to test whether current member California is in a list of members so that you can adjust salary to match California's higher cost of living. Hyperion Essbase Calc Scripts Boolean Functions 6 Summary of Boolean Functions This table summarizes the Boolean Functions. or the specified member itself? Is the current member a child of the specified member. or the specified member itself? Is the member being calculated a descendant of the specified member. in detail. or the specified member itself? Is the current member at the specified dimension level? Is calculation being done for the specified member? Is the current member the parent of the specified member? Is the current member the same generation as the specified member? Is the current member the same level as the specified member? @ISANCEST @ISCHILD @ISDESC @ISGEN @ISIANCEST @ISICHILD @ISIDESC @ISIPARENT @ISISIBLING @ISLEV @ISMBR @ISPARENT @ISSAMEGEN @ISSAMELEV Hyperion 6-3 . in this chapter. Each function is also described. or the specified member itself? Is the current member a sibling of the specified member. or the specified member itself? Is the current member the parent of the specified member. Function @ISACCTYPE Tests Does current member have the specified accounts tag? Is the current member an ancestor of the specified member? Is the current member a child of the specified member? Is the current member a descendant of the specified member? Is the current member at the specified dimension generation Is the current member an ancestor of the specified member. 6 Boolean Functions Hyperion Essbase Calc Scripts Function @ISSIBLING Tests Is the current member a sibling of the specified member? Does the current member of the specified dimension have the specified user-defined attribute (UDA) at the time of the calculation? @ISUDA 6-4 Hyperion . Any of the following tags may be used: First. and TwoPass.Valid account tag defined in the current database. Example The following example is based on the Sample Basic database. Syntax @ISACCTYPE(tag) tag . For members with the Expense accounts tag. Average. ENDIF. the formula uses the @ABS function to calculate Budget as the absolute value of Budget. Hyperion 6-5 . IF (@ISACCTYPE(Expense)) Budget = @ABS(Budget). Expense. Last.Hyperion Essbase Calc Scripts Boolean Functions 6 @ISACCTYPE The @ISACCTYPE() function returns TRUE if the current member has the specified accounts tag. East. @ISIANCEST(West) returns FALSE for California. Syntax @ISANCEST(mbrName) @ISIANCEST(mbrName) Example In the Sample Basic database: @ISANCEST(California) returns TRUE for Market. West. East. @ISIANCEST(California) returnsTRUE for California.6 Boolean Functions Hyperion Essbase Calc Scripts @ISANCEST. Market. @ISANCEST(West) returns FALSE for California. @ISANCEST The @ISANCEST() function returns TRUE if the current member is an ancestor of the specified member. This function excludes the specified member. West. West. 6-6 Hyperion . The @ISIANCEST() function returns TRUE if the current member is the specified member or an ancestor of the specified member. East. @ISICHILD(East) returns TRUE for New York. This function excludes the specified member. Connecticut. Florida.Hyperion Essbase Calc Scripts Boolean Functions 6 @ISCHILD. @ISICHILD The @ISCHILD() function returns TRUE if the current member is a child of the specified member. Florida. @ISCHILD(Margin) returns FALSE for Measures. Connecticut. The @ISICHILD() function returns TRUE if the current member is the specified member or a child of the specified member. @ISICHILD(Margin) returns FALSE for Measures. Syntax @ISCHILD(mbrName) @ISICHILD(mbrName) Example In the Sample Basic database: @ISCHILD(East) returns TRUE for New York. Profit. Margin. Profit. Hyperion 6-7 . ENDIF) The example operates as follows: The IF condition uses @ISDESC to determine whether the member of the Market dimension being calculated is a descendant of either East or West. ELSE Payroll = Sales * . If the member being calculated on the Market dimension is a descendant of East or West. or the member itself. The @ISDESC function excludes the specified member. Payroll is calculated by multiplying the value in Sales by 0.10. 6-8 Hyperion . @ISIDESC The @ISDESC function returns TRUE if the member being calculated is a descendant of the referenced member.6 Boolean Functions Hyperion Essbase Calc Scripts @ISDESC. Syntax @ISDESC (mbrName) @ISIDESC (mbrName) Example Payroll (IF(@ISDESC(East) OR @ISDESC (West)) Payroll = Sales * .15. or Central. Payroll is calculated by multiplying the value in Sales by 0. Payroll is calculated by multiplying value in Sales by 0.10. If the current member on the Market dimension is a descendant of Central.11. the ELSEIF condition uses the @ISDESC function to determine whether the current member is a descendant of Central.11. If the current member is not a descendant of East. If the current member is not a descendant of East or West. West. @ISIDESC returns TRUE if the member being calculated is a descendant of the referenced member. ELSEIF (@ISDESC (Central)) Payroll = Sales * .15. ”East”) returns TRUE if the current member is East. South or Central because these members are not in the same Market dimension generation as East.Generation name that defines the number of a generation. Example In the Sample Basic database: @ISGEN(Measures. because these members are all in generation 3 of the Measures dimension. @ISGEN(Market. Syntax @ISGEN(dimName. Total Inventory.A non-negative number that defines the number of a generation. or Margin %. Hyperion 6-9 . West. or genNum . genName | genNum) genName .3) returns TRUE if the current member is Margin.Hyperion Essbase Calc Scripts Boolean Functions 6 @ISGEN The @ISGEN() function returns TRUE if the current member of the specified dimension is in the specified generation. all higher levels are aggregated by default.6 Boolean Functions Hyperion Essbase Calc Scripts @ISLEV The @ISLEV function returns TRUE if the current member (the member being calculated) of the specified dimension is at the specified level. or numeric expression (The numeric expression provides an integer value equal to or greater than 0. “Florida”. Notes Using @ISLEV can significantly reduce calculation time. Syntax @ISLEV (dimName. use @ISLEV to isolate the calculation. thus preventing the default aggregation behavior. 6-10 Hyperion . because these members are all in level 0 of the Market dimension.Member specification. The @ISLEV function determines position within a hierarchy and is particularly useful when working with asymmetric hierarchies. level) level . variable name. and identifies the level. etc. “California”. returns FASLE if the current member is East because East has children and therefore is a Level 1 member.) Example IF (@ISLEV("Market". 0)) • • returns TRUE if the current member is “New York”. To prevent this. If a lower-level formula is calculated. the term evaluates as TRUE only if all the cross-dimensional member's components match the current member list. Hyperion 6-11 . If a cross-dimensional (->) member term is included. @ISMBR(“New York”. Syntax @ISMBR (mbrName | rangeList | mbrList) Example Commission (IF @ISMBR(Actual) Commission = Sales *.Texas) FALSE for Connecticut. results such as the following are returned (for the Sample Basic database): @ISMBR(“New York”:”New Hampshire”) TRUE for Connecticut. ELSEIF (@ISMBR(Budget)) Commission = 100.Oregon. A single member. Notes If you examine the contents of a range or list of values.10. or a discrete list of members may be specified.Hyperion Essbase Calc Scripts Boolean Functions 6 @ISMBR The @ISMBR function returns TRUE if any specified member matches the member being calculated. a range of members. ENDIF) The example syntax calculates different values for Commission for Actual and Budget. @ISIPARENT The @ISPARENT() function returns TRUE if the current member is the parent of the specified member. This function excludes the specified member. New York. @ISPARENT(Profit) returns FALSE for Margin.6 Boolean Functions Hyperion Essbase Calc Scripts @ISPARENT. Profit. @ISIPARENT("New York") returns TRUE for East. 6-12 Hyperion . Syntax @ISPARENT(mbrName) @ISIPARENT(mbrName) Example In the Sample Basic database: @ISPARENT("New York") returns TRUE for East. The @ISIPARENT() function returns TRUE if the current member is the specified member or the parent of the specified member. @ISIPARENT(Profit) returns FALSE for Margin. Hyperion Essbase Calc Scripts Boolean Functions 6 @ISSAMEGEN The @ISSAMEGEN() function returns TRUE if the current member is the same generation as the specified member. Oct. @ISSAMELEV The @ISSAMELEV() function returns TRUE if the current member is the same level as the specified member. Syntax @ISSAMEGEN(mbrName) Example In the Sample Basic database: @ISSAMEGEN(West)returns TRUE for East. @ISSAMELEV(Jan)returns TRUE for Apr. Syntax @ISSAMELEV(mbrName) Example In the Sample Basic database: @ISSAMELEV(Sales)returns FALSE for Total Expenses . Hyperion 6-13 . @ISSAMEGEN(West)returns FALSE for California. Jul. @ISISIBLING The @ISSIBLING() function returns TRUE if the current member is a sibling of the specified member. The @ISISIBLING() function returns TRUE if the current member is the specified member or a sibling of the specified member. @ISSIBLING(Sales)returns FALSE for Margin. Syntax @ISSIBLING(mbrName) @ISISIBLING(mbrName) Example In the Sample Basic database: @ISSIBLING("New York")returns TRUE for Florida. New York. Sales. New Hampshire. New Hampshire. @ISISIBLING("New York")returns TRUE for Florida.6 Boolean Functions Hyperion Essbase Calc Scripts @ISSIBLING. @ISISIBLING(Sales)returns FALSE for Margin. This function excludes the specified member. 6-14 Hyperion . 1. The Market dimension has members that indicate a geographic location. If it does. the Budget->Sales value is set to 110% of Actual->Sales. ENDFIX This example tests to see if the current member of Market has a UDA called "Major Market". FIX (Budget) Sales (IF(@ISUDA(Market. Hyperion 6-15 . Example This example is based on the Sample Basic database. If it does not.2. The example below calculates the database and stores a budget amount for the upcoming year based on the actual amount from this year.user-defined attribute (UDA) name string. A different sales growth rate is applied to major markets than to small markets. Some members represent major markets. the Budget->Sales value is set to 120% of Actual->Sales.UDAStr) UDAStr ."Major Market")) Sales = Sales->Actual * 1. ELSE Sales = Sales->Actual * 1. ENDIF.Hyperion Essbase Calc Scripts Boolean Functions 6 @ISUDA The @ISUDA() function returns TRUE if the specified user-defined attribute (UDA) exists for the current member of the specified dimension at the time of the calculation.). Syntax @ISUDA(dimName. placement of parentheses is very important. 6-16 Hyperion . you should be careful of compound conditions.6 Boolean Functions Hyperion Essbase Calc Scripts Using Logical Connectors with Boolean Functions Although the use of logical connectors is straightforward. ENDIF) Some conditional Boolean statements can be complex: "TAX RATE" (IF(NOT(@ISLEV(GEOGRAPHY. ENDIF) Usage When using compound IF statements. as in the second example. Refer to the following table to reinforce your understanding of logical connectors: Condition1 Condition2 Condition1 Condition1 NOT (Condition1) AND Condition2 True True False False True False True False True False False False OR Condition2 True True True False False False True True Examples Note the use of the NOT connector in the first example: COMMISSION (IF(NOT(@ISUDA(SCENARIO.0) AND @ISLEV(TIME."MYUDA"))) COMMISSION = 100.0))) "TAX RATE" = ("TAX PROVISION"/"PRE TAX INCOME") * 100. Be careful when using NOT and when placing parentheses. you use the @ISDESC function within a calc script to calculate the budgeted product sales for all cities. If not. Close the SS_Bool spreadsheet. and 2000 sales for cities in the Central region to decrease by 5% from actual 1999 sales. Open the SS_Bool spreadsheet. The company expects 2000 sales for cities in the South to increase by 15% over actual 1999 sales. 2000 sales for cities in the East and West to increase by 10% over actual 1999 sales. Perform a retrieval and compare the calculation results to the Expected Values column. clear all data from your HLandS1 database. Save the new script as CSBool. From the Calc&Retrieve sheet. Create a new calc script to calculate the 2000 budgeted product sales for all cities.xls 1) 2) From Essbase Application Manager. Lock and send the 1999 Actual Sales data in the Lock&Send sheet to the HLandS1 database. Ensure that the projected sales are calculated correctly.Hyperion Essbase Calc Scripts Boolean Functions 6 Exercise 6-1: Using Boolean Functions In this exercise. 2000 sales for cities in the East and West to increase by 10% over actual 1999 sales. and 2000 sales for cities in the Central region to decrease by 5% from actual 1999 sales. run the CSBool calc script. revise the calc script and rerun the calculation. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSBool SS_Bool. The company projects 2000 sales for cities in the South to increase by 15% over actual 1999 sales. 3) 4) 5) 6) 7) 8) Hyperion 6-17 . For this exercise. Many conditional statements use Boolean functions to identify characteristics of the member for which calculations are currently being performed. Compound conditions can also be created by using: • • logical connectors: AND.6 Boolean Functions Hyperion Essbase Calc Scripts Unit Summary Tests can be performed on data using if-logic of the conditional statements. OR and NOT parenthesis to control the logical interpretation 6-18 Hyperion . East and Market. Perform a calculation for “New York”. Hyperion 6-19 . Perform a calculation for “New York”. and all the cities in the East market. identify the Boolean function that you would use to isolate the required members.Hyperion Essbase Calc Scripts Boolean Functions 6 þ Check Your Understanding Now that you have completed the chapter. Use the Sample Basic outline. check your understanding by responding to the following questions: 1) For each of the following situations. Perform a calculation for all accounts that are identified as “Expense”. only? Perform a calculation for East. only. Perform a calculation for all level one members of the Market Dimension. Perform a calculation for “New York”. Perform a calculation for all accounts that are identified as “Expense”. only. @ISMBR @ISICHILD @ISLEV @ISIANCEST @ISACCTYPE 6-20 Hyperion . identify the Boolean function that you would use to isolate the required members. East and Market. Perform a calculation for all level one members of the Market Dimension. and all the cities in the East market. Use the Sample Basic outline. Perform a calculation for “New York”. only? Perform a calculation for East.6 Boolean Functions þ Check Your Understanding Solutions 1) Hyperion Essbase Calc Scripts For each of the following situations. Hyperion Essbase Calc Scripts Boolean Functions 6 Hyperion 6-21 . 6 Boolean Functions Hyperion Essbase Calc Scripts 6-22 Hyperion . you will be able to: • • Explain the purpose and use of member set functions to generate member lists Practice using the member set functions in a series of incremental exercises .7 Member Set Functions Chapter Objectives By the end of this chapter. mbrName2 genLevNum An integer value that defines the generation or level number from which the ancestor value is returned. Single dimension name specification. and Chicago. and Chicago. The member list is generated dynamically at the time the member set function is executed. If a generation or level number is required. Other member sets generate lists in a variety of ways. such as performing a search on a wild card pattern. A positive integer defines a generation number. @UDA. the current calculation position affects the returned list. @RELATIVE Generation and level member sets generate a list of members based upon a generation or level number. @MATCH. Obviously. For example. 7-2 Hyperion . @LEVMBRS. mbrName1. Specifies a single member. @CHILDREN. the generated list includes the referenced member and the requested members. Member set functions can be broken into three basic categories: Family member sets generate a list of members based upon a hierarchical relationship. for example. if the parameter of the other function can be list of members. for example.7 Member Set Functions Hyperion Essbase Calc Scripts Generating Lists Using Member set Functions A member set function generates a list of members based on the criteria provided as arguments. A member set function can be used as a parameter of another function. and @IDESCENDANTS(EAST) includes East. if @DESCENDANTS(EAST) includes New York. thus reducing the need to hard-code member names. @DESCENDANTS. When a member set function begins with an “@I”. for example. @SIBLING. Boston. Boston. A value of 0 or a negative integer defines a level number. New York. @GENMBRS. Using a member set function in conjunction with the FIX command fixes on a list of members. Member Set Function Parameters There are common parameters associated with the various member set functions: dimName mbrName. this can be used to resolve issues of data that may be constantly changing and to avoid hard-coding of member lists. The specified member and all descendants of the specified member. or those down to the specified generation or level. Function @ALLANCESTORS Used to generate a list containing All the ancestors of that member. All base members that are associated with the specified attribute member. The member that is currently being calculated in the specified dimension. All ancestors of the specified member or those up to the specified generation or level. or those down to the specified generation or level. The specified member and all members that share the same parent as that member and that follow that member in the database outline. in this chapter. The specified member and all members in the level immediately below the specified member. @ANCEST @ANCESTORS @ATTRIBUTE @CHILDREN @CURRMBR @DESCENDANTS @GENMBRS @IALLANCESTORS @IANCESTORS @ICHILDREN @IDESCENDANTS @ILSIBLINGS @IRSIBLINGS Hyperion 7-3 . All members with the specified generation number or generation name in the specified dimension. including ancestors of any occurrences of the specified member as a shared member. The specified member and all members that share the same parent as that member and precede that member in the database outline. including ancestors of any occurrences of the specified member as a shared member. The specified member and all the ancestors of that member. The ancestor at the specified generation or level in the specified dimension of the current member being calculated. All descendants of the specified member. in detail. All members in the level immediately below the specified member. The specified member and all ancestors of the specified member or those up to the specified generation or level. Each function is also described.Hyperion Essbase Calc Scripts Member Set Functions 7 Summary of Member Set Functions This table summarizes the Member Set Functions. or those down to the specified generation or level. Members with a common user-defined attribute (UDA). All members that share the same parent as the specified member and precede that member in the database outline. The member with the name that is provided as a character string. All base members that are associated with an attribute that satisfies a specified condition. A list from which with selected values have been removed. A member list that crosses the specified member from one dimension with the specified member range from another dimension. The parent of the current member being calculated in the specified dimension. The specified member and all siblings of that member. All members at the specified generation or level that are above or below the specified member in the database outline. @ISIBLINGS @LEVMBRS @LIST @LSIBLINGS @MATCH @MEMBER @MERGE @PARENT @RANGE @RDESCENDANTS @RELATIVE @REMOVE @RSIBLINGS @SIBLINGS @UDA @WITHATTR 7-4 Hyperion . All siblings of the specified member. or those down to the specified generation or level. All descendants of the specified member (including descendants of shared members). A collection of individual items that are to be passed to functions that require list arguments. All members with the specified level number or level name in the specified dimension. All members whose names match a specified pattern. All members that share the same parent as the specified member and that follow that member in the database outline.7 Member Set Functions Hyperion Essbase Calc Scripts Function @IRDESCENDANTS Used to generate a list containing The specified member and all descendants of the specified member (including descendants of shared members). The union of two member lists that are to be passed to another function. Hyperion Essbase Calc Scripts Member Set Functions 7 Function @XRANGE * Used to generate a list containing All members in the range specified by the arguments used in the function. * New in Essbase XTD Release 6.1.5. Hyperion 7-5 . including ancestors of any occurrences of the specified member as a shared member. Sample Basic has a shared level of diet drinks. @ALLANCESTORS("100-20")returns “100”. This order is important to consider when you use the @ALLANCESTORS member set function with certain forecasting and statistical functions. the order in which shared ancestors are returned is not guaranteed. However. 7-6 Hyperion . “Diet” and “Product” Notes Essbase sorts the generated list of members in ascending order of the member number in the outline. which includes 100-20 (Diet Cola). Syntax @ALLANCESTORS(mbrName) Example The following example is based on the Sample Basic database. This function excludes the specified member.7 Member Set Functions Hyperion Essbase Calc Scripts @ALLANCESTORS The @ALLANCESTORS() function returns all ancestors of the specified member. So 100-20 (Diet Cola) is a descendant of 100 (Colas) and is a shared member descendant of Diet. If you specify the optional mbrName. Sales = @ANCESTVAL(Product. You can use the @ANCEST function on both the left-hand and right-hand sides of a formula.3.2). that ancestor is combined with the specified member.Sales) returns Colas->Sales.2.East) returns Total Expenses->East. if the current member of Measures being calculated is Payroll. @ANCEST(Measures. the following two formulas are equivalent: Sales = @ANCEST(Product. In some cases.2). Notes You cannot use the @ANCEST function in a FIX statement. if the current member of Product being calculated is Diet Cola. genLevNum [. For example. except in terms of calculation performance. the @ANCEST function is equivalent to the @ANCESTVAL function. In this case. mbrName]) Example In the Sample Basic database: @ANCEST(Product.Hyperion Essbase Calc Scripts Member Set Functions 7 @ANCEST The @ANCEST() function returns the ancestor at the specified generation or level of the current member being calculated in the specified dimension. The time required for retrieval and calculation may be significantly longer if this function is in a formula attached to a member tagged as Dynamic Calc or Dynamic Calc and Store. using the latter formula results in better calculation performance. Syntax @ANCEST(dimName. Hyperion 7-7 . 7-8 Hyperion . This order is important to consider when you use the @ANCESTORS member set function with certain forecasting and statistical functions. @ANCESTORS(Qtr4)returns Year. Market (in that order). @ANCESTORS("100-10".-2) eturns Margin.1)returns 100. @ANCESTORS(Sales. genLevNum | genLevName]) Example In the Sample Basic database: @ANCESTORS("New York")returns East. and so on. followed by nearest ancestor of the member. then the next nearest ancestor of the member. Notes Essbase sorts the generated list of members starting with the specified member. Syntax @ANCESTORS (mbrName [. Product (in that order). Profit (in that order).7 Member Set Functions Hyperion Essbase Calc Scripts @ANCESTORS The @ANCESTORS() function returns all ancestors of the specified member or those up to a specified generation or level. To distinguish duplicate member names. in the Sample Basic database. To return only one. Essbase returns all base members that are associated with the children of the attribute member. @ATTRIBUTE(Large) returns all base members that fall into one of the population ranges for the attribute parent Large. For example. date. Diet Cola. Notes When @ATTRIBUTE is used with a non-level 0 member of an attribute dimension. If you specify the name of a Boolean attribute dimension (for example.Hyperion Essbase Calc Scripts Member Set Functions 7 @ATTRIBUTE The @ATTRIBUTE() function generates a list of all base members that are associated with the specified attribute member. specify the full attribute member name (for example. You may have duplicate Boolean. Hyperion 7-9 . specify the member name (for example. @ATTRIBUTE(Caffeinated_True)). Caffeinated). @ATTRIBUTE(12_Ounces)). and Diet Cream. Example In the Sample Basic database. Essbase sorts the generated list of members in ascending order from the database outline.Single attribute member name or member combination. and numeric attribute member names in your outline. True or False). 12 can be the attribute value for the size (in ounces) of a product as well as the value for the number of packing units for a product. This order is important to consider when you use the @ATTRIBUTE member set function with certain forecasting and statistical functions. For example. Essbase returns all base members that are associated with either Caffeinated member (for example. Syntax @ATTRIBUTE (attMbrName) attMbrName . @ATTRIBUTE(Can) returns all base members with the Can attribute: Cola. 100-20. South. Notes Essbase sorts the generated list of members in ascending order. This order is important to consider when you use the @CHILDREN member set function with certain forecasting and statistical functions. 7-10 Hyperion .7 Member Set Functions Hyperion Essbase Calc Scripts @CHILDREN The @CHILDREN () function returns all children of the specified member. if you specify 100 for mbrName. West. and Central. Syntax @CHILDREN(mbrName) Example In the Sample Basic database: @CHILDREN(Market)returns East. excluding the specified member. 100-30 (in that order). Using Sample Basic as an example. @CHILDREN(Margin)returns Sales and COGS. Essbase returns 100-10. Hyperion Essbase Calc Scripts Member Set Functions 7 @CURRMBR The @CURRMBR() function returns the member that is currently being calculated in the specified dimension. Syntax @CURRMBR(dimName) Example In the Sample Basic database. The time required for retrieval and calculation may be significantly longer if this function is in a formula attached to a member tagged as Dynamic Calc or Dynamic Calc and Store. You cannot use the @CURRMBR function on the left-hand side of a formula. Hyperion 7-11 . Notes You cannot use the @CURRMBR function in a FIX statement. @CURRMBR(Year)returns Jan if the current member of Year being calculated is Jan. As a more complex example. consider: @CHILDREN(@CURRMBR(Product)) generates a list of all children for the current member of the Product dimension. 7-12 Hyperion . A value of 0 or a negative integer defines a level number. This order is important to consider when you use the @DESCENDANTS member set function with certain forecasting and statistical functions. Syntax @DESCENDANTS(mbrName [. Example In the Sample Basic database: @DESCENDANTS(East)returns New York. Total Expenses. Notes Essbase sorts the generated list of members starting with the nearest descendant of the member. genLevNum| genLevName]) Optional genLevNum . Sales. and so on. @DESCENDANTS(Diet. COGS. and Misc. 200-20. and Central . @DESCENDANTS(Profit)returns Margin. This function excludes the specified member. @DESCENDANTS(Market. Marketing.0)returns 100-20.7 Member Set Functions Hyperion Essbase Calc Scripts @DESCENDANTS The @DESCENDANTS function returns all descendants of the specified member. followed by the next nearest descendant of the member. or those down to the specified generation or level. and 300-30. Payroll. South. Florida. and New Hampshire. West. Massachusetts.Level name or generation name down to which to select the members.An integer value that defines the absolute generation or level number down to which to select the members. A positive integer defines a generation number. or genLevName . Connecticut.2)returns East. Syntax @GENMBRS(dimName. Essbase returns 100. Essbase sorts the generated list of members in ascending order. Essbase does not recognize the value of the variable.2). or genName . Essbase checks to see if the parameter is a valid generation number. Essbase looks for a generation with that name in the specified dimension. Diet (in that order). Using Sample Basic as an example. Aug. If no generation name exists with that numeric name. and Dec (in that order).”May”) @GENMBRS(Year. It looks in the outline for a generation name with the same name as the temporary variable. Hyperion 7-13 . Example In the Sample Basic database: @GENMBRS(Year. Essbase first looks for a generation with a number string name. Jul. If you specify a number for the genName parameter. Mar.3) both return Jan.genName|genNum) genNum . May. 200. 300. Nov. Notes If you specify a name for the genName parameter.Generation name from the specified dimension. if you specify @GENMBRS(Product.Hyperion Essbase Calc Scripts Member Set Functions 7 @GENMBRS The @GENMBRS() function returns all members with the specified generation number or generation name in the specified dimension. 400. Apr.An positive integer value that defines the absolute generation number. If you specify a temporary variable for the genName parameter. Feb. Jun. Oct. Sep. This order is important to consider when you use the @GENMBRS member set function with certain forecasting and statistical functions. “100”. “Diet” and “Product” Notes Essbase sorts the generated list of members in ascending order of the member number in the outline. Syntax @IALLANCESTORS(mbrName) Example The following example is based on the Sample Basic database. 7-14 Hyperion .7 Member Set Functions Hyperion Essbase Calc Scripts @IALLANCESTORS The @IALLANCESTORS() function returns the specified member and all the ancestors of that member. which includes 100-20 (Diet Cola). including ancestors of any occurrences of the specified member as a shared member. However. Sample Basic has a shared level of diet drinks. So 100-20 (Diet Cola) is a descendant of 100 (Colas) and is a shared member descendant of Diet. @IALLANCESTORS("100-20") returns “100-20”. This order is important to consider when you use the @IALLANCESTORS member set function with certain forecasting and statistical functions. the order in which shared ancestors are returned is not guaranteed. genLevNum | genLevName]) Example In the Sample Basic database: @IANCESTORS("New York") returns “New York”. and so on. @IANCESTORS(Qtr4) returns Qtr4.Hyperion Essbase Calc Scripts Member Set Functions 7 @IANCESTORS The @IANCESTORS() function returns the specified member and all ancestors of the specified member or those up to the specified generation or level. East. Year. Notes Essbase sorts the generated list of members starting with the specified member.-2) returns Sales. Profit (in that order). @IANCESTORS("100-10". Margin. Syntax @IANCESTORS (mbrName [. 100.1) returns "100-10". This order is important to consider when you use the @ANCESTORS member set function with certain forecasting and statistical functions. Market (in that order). followed by nearest ancestor of the member. Hyperion 7-15 . @IANCESTORS(Sales. Product (in that order). then the next nearest ancestor of the member. and Central. This order is important to consider when you use the @ICHILDREN member set function with certain forecasting and statistical functions.7 Member Set Functions Hyperion Essbase Calc Scripts @ICHILDREN The @ICHILDREN() function includes the specified member and all members in the level immediately below the specified member. @ICHILDREN(Margin)returns Margin. 7-16 Hyperion . Notes Essbase sorts the generated list of members starting with the specified member. West. South. East. Sales and COGS. followed by its children in ascending order. Syntax @ICHILDREN(mbrName) Example In the Sample Basic database: @ICHILDREN(Market)returns Market. @IDESCENDANTS(Diet. Total Expenses. Payroll. and New Hampshire.Hyperion Essbase Calc Scripts Member Set Functions 7 @IDESCENDANTS The @IDESCENDANTS function returns the specified member and all descendants of the specified member.Level name or generation name down to which to select the members. Syntax @IDESCENDANTS(mbrName [. and Misc. or genLevName . or those down to the specified generation or level. Hyperion 7-17 .0)returns Diet. Sales. A positive integer defines a generation number. COGS. 200-20. East. and West. and so on This order is important to consider when you use the @IDESCENDANTS member set function with certain forecasting and statistical functions. A value of 0 or a negative integer defines a level number. Example In the Sample Basic database: @IDESCENDANTS(East) returns East. Notes Essbase sorts the generated list of members as follows: • • • The specified member The nearest descendant of the member The next nearest descendant of the member. New York. genLevNum| genLevName]) genLevNum . @IDESCENDANTS(Profit)returns Profi. Marketing. Massachusetts. Connecticut. 100-20. @IDESCENDANTS(Market. and 300-30. Margin. Florida.An integer value that defines the absolute generation or level number down to which to select the members.2) returns Market. Qtr2. siblings appearing above the member in the database outline) in ascending order. and Qtr3. Left siblings are children that share the same parent as the member and that precede the member in the database outline.7 Member Set Functions Hyperion Essbase Calc Scripts @ILSIBLINGS The @ILSIBLINGS() function returns the specified member and all of the left siblings of the member. This order is important to consider when you use the @ILSIBLINGS member set function with certain forecasting and statistical functions. Syntax @ILSIBLINGS(mbrName) Example In the Sample Basic database: @ILSIBLINGS(Florida) returns New York. Massachusetts. @ILSIBLINGS(Qtr3) returns Qtr1. Notes Essbase sorts the generated list of members starting with the left siblings of the member (that is. and Florida . 7-18 Hyperion . @IRDESCENDANTS(Diet) returns the members: Diet. or genLevName . Syntax @IRDESCENDANTS(mbrName [. 100-20. A positive integer defines a generation number. Hyperion 7-19 . 100-10. or those down to the specified generation or level. 200-20.Hyperion Essbase Calc Scripts Member Set Functions 7 @IRDESCENDANTS The @IRDESCENDANTS function returns the specified member and all its descendants. 100. 200-30.Level name or generation name down to which to select the members.An integer value that defines the absolute generation or level number down to which to select the members. genLevNum| genLevName]) genLevNum . 200. A value of 0 or a negative integer defines a level number. the result also includes either all descendants of each member being shared or descendants down to the specified generation or level. 200-10. Example Consider an outline with the following Product dimension: Product 100 100-10 100-20 100-30 200 200-10 200-20 200-30 200-40 Diet 100 (Shared Member) 200 (Shared Member) Diet has two children "100" and "200". If one or more of the descendants are shared. 100-30. The members "100" and "200" are shared members. 200-40 (in that order). The order of members in the result list is important to consider when you use the @IRDESCENDANTS member set function with certain forecasting and statistical functions.7 Member Set Functions Hyperion Essbase Calc Scripts Notes In the absence of shared members. Essbase generates the list of members in the following sequence: • • • • The specified member The nearest descendant of the member The next nearest descendant of the member. the above steps are repeated on the member being shared. @IRDESCENDANTS and @IDESCENDANTS return the same result. 7-20 Hyperion . If a shared member is encountered. and so on. Connecticut. if you specify 200-20 for mbrName. Right siblings are children that share the same parent as the member and that follow the member in the database outline. Using Sample Basic as an example. This order is important to consider when you use the @IRSIBLINGS member set function with certain forecasting and statistical functions. @IRSIBLINGS(Qtr3) returns Qtr3 and Qtr4. and New Hampshire. Notes Essbase sorts the generated list of members starting with the specified member. 200-40 (in that order). Essbase returns 200-20. followed by the right siblings of the member (that is. 200-30.Hyperion Essbase Calc Scripts Member Set Functions 7 @IRSIBLINGS The @IRSIBLINGS() function returns the specified member and all of the right siblings of the specified member. Syntax @IRSIBLINGS (mbrName) Example In the Sample Basic database: @IRSIBLINGS(Florida) returns Florida. siblings appearing below the member in the database outline) in ascending order. Hyperion 7-21 . 7 Member Set Functions Hyperion Essbase Calc Scripts @ISIBLINGS The @ISIBLINGS() function returns the specified member and all siblings of that member. Syntax @ISIBLINGS (mbrName) Example In the Sample Basic database: @ISIBLINGS(California) returns California. Utah. and Qtr4 (in that order). Qtr2. Notes Essbase sorts the generated list of members in ascending order. Washington. 200-30. . Oregon. 7-22 Hyperion . if you specify 200-30 for mbrName. Essbase returns 200-10. Using Sample Basic as an example. Qtr3. This order is important to consider when you use the @ISIBLINGS member set function with certain forecasting and statistical functions. @ISIBLINGS(Qtr2) returns Qtr1. 200-40 (in that order). 200-20. and Nevada (in that order). @LEVMBRS(Scenario. If you specify a number for the levName parameter (for example. Essbase first looks for a level with a number string name. levName|levNum) levName . Opening Inventory. Essbase does not recognize the value of the variable. Marketing. Hyperion 7-23 . Margin %. 2).0) both return Sales.Hyperion Essbase Calc Scripts Member Set Functions 7 @LEVMBRS The @LEVMBRS() function returns all members with the specified level number or level name in the specified dimension. Additions.” Notes If you specify a name for the levName parameter. If no level name exists with that name. or levNum . Variance. If you specify a temporary variable for the levName parameter.0) returns Actual. Example In the Sample Basic database: @LEVMBRS(Measures. Essbase looks for a level with that name in the specified dimension.An integer value that defines the number of a level. COGS. The integer value must be 0 or a positive integer. Payroll. Misc. It looks in the outline for a level name with the same name as the temporary variable. Budget. Profit %.A level name of the specified dimension. Essbase checks to see if the parameter is a valid level number."Profit and Loss") @LEVMBRS(Measures. and Profit per Ounce (in that order). and “Variance %. Ending Inventory. Syntax @LEVMBRS(dimName. If you use a negative number for the level number. 7-24 Hyperion . but the calculation will fail with an error message. This order is important to consider when you use the @LEVMBRS member set function with certain forecasting and statistical functions.7 Member Set Functions Hyperion Essbase Calc Scripts Essbase sorts the generated list of members in ascending order. no syntax error is noted. The list of arguments that are collected and treated as one argument so they can be processed by the parent function. Hyperion 7-25 .. range functions.. Example A company ran special promotional activities for January. argumentN) argument1. Their Essbase database has an account field to store sales for the promotional periods. member combinations. @LIST can be used to create expLists. argument2. argumentN .. and numeric expressions. member lists.. member set functions. argument2.Hyperion Essbase Calc Scripts Member Set Functions 7 @LIST The @LIST() function creates and distinguishes lists that are processed by functions that require list arguments.Jun.. @LIST treats a collection of parameters as one entity. ENDFIX Notes @LIST does not check for or eliminate repetitions. Syntax @LIST(argument1. or rangeLists. June and August. Arguments can be member names.. Aug)). One way to populate this field: FIX (Sales) “Special Sales”= @SUM(@LIST(Jan... 7 Member Set Functions Hyperion Essbase Calc Scripts @LSIBLINGS The @LSIBLINGS() function returns the left siblings of the specified member. 7-26 Hyperion . Oregon. Notes Essbase sorts the generated list of left siblings in descending order. @LSIBLINGS(Utah) returns Washington. and California. Qtr2. This order is important to consider when you use the @LSIBLINGS member set function with certain forecasting and statistical functions. Syntax @LSIBLINGS (mbrName) Example In the Sample Basic database: @LSIBLINGS(Qtr4) returns Qtr3. and Qtr1. Left siblings are children that share the same parent as the member and that precede the member in the database outline. This function excludes the specified member. "???-10") returns: 100-10. 300-10. 200-10. including a wildcard character (* or ?). Example In the Sample Basic database: @MATCH(Product. Hyperion 7-27 . enclose the pattern in double quotation marks ("").The default or user-defined name of the generation to search.The default or user-defined name of the member on which to base the search. 100-10 (Cola). Essbase searches all member names and member alias names in the level. "pattern" The character pattern to search for. You can use * only at the end of the pattern. and 400-10 @MATCH(Year. 300 (Cream Soda) Notes ? substitutes one occurrence of any character. To include spaces in the character pattern. Jun. 100-30 (Caffeine Free Cola). You can use ? anywhere in the pattern. Jul @MATCH(Product. or genName . "pattern") mbrName . Syntax @MATCH (mbrName|genName|levName. or levName -The default or user-defined name of the level to search. Essbase searches all member names and member alias names in the generation."C*") returns: 100 (Colas). * substitutes any number of characters. Essbase searches the member names and alias names of the specified member and its descendants.Hyperion Essbase Calc Scripts Member Set Functions 7 @MATCH The @MATCH function performs wildcard member selections."J*") returns: Jan. the search is case-sensitive. To define database member names as case-sensitive. choose Settings | Case Sensitive Members from the Application Manager Outline Editor menu. Essbase searches for member names and alias names that match the pattern you specify and returns the member and alias names it finds. If Essbase does not find any members that match the chosen character pattern.7 Member Set Functions Hyperion Essbase Calc Scripts This function performs a trailing-wildcard member selection. 7-28 Hyperion . it returns no member names and continues with the other calculation commands in the calculation script. If the members names in the database you are searching are case-sensitive. Otherwise. the search is not case-sensitive. the member name QTR1 is appended to the character string 2000_ to form the string 2000_QTR1. Syntax @MEMBER (String) String . Hyperion 7-29 . QTD=@MEMBER(@CONCATENATE("2000_". In the following example.Hyperion Essbase Calc Scripts Member Set Functions 7 @MEMBER The @MEMBER function returns the member with the name that is provided as a character string. the @MEMBER function is used in combination with string functions that are used to manipulate character strings to form the name of a member. QTR1)). The @MEMBER function returns the member 2000_QTR1 and QTD is set to the value of this member.A string (enclosed in double quotation marks) or a function that returns a string Example Typically. @MERGE(@CHILDREN(Colas). @MERGE can merge only two lists at a time. and Diet Cream Soda. You can nest @MERGE functions to merge more than two lists. even though it is a child of both Colas and Diet Drinks. Example In the Sample Basic database.7 Member Set Functions Hyperion Essbase Calc Scripts @MERGE The @MERGE() function merges two member lists that are processed by another function. list2 . Caffeine Free Cola.@CHILDREN("Diet Drinks")) returns Cola. list2) list1 . Notes Duplicate values are included only once in the merged list. Diet Root Beer. Diet Cola appears only once in the merged list.The second list of member specifications to be merged. Duplicate values from both lists are included only once in the merged list. Diet Cola.The first list of member specifications to be merged. 7-30 Hyperion . Syntax @MERGE(list1. In general. associate it with a member. The time required for retrieval and calculation may be significantly longer if this function is in a formula attached to a member tagged as Dynamic Calc or Dynamic Calc and Store. Example In the Sample Basic database: @PARENT(Market. @PARENT(Measures)returns Profit. or a function that returns a single member or member combination. For example: Sales(@PARENT(Product) = 5.Hyperion Essbase Calc Scripts Member Set Functions 7 @PARENT The @PARENT () function returns the parent of the current member being calculated in the specified dimension. that parent is combined with the specified member. if the current member of Market being calculated is Colorado. If you specify the optional member. Hyperion 7-31 . that is combined with the parent returned. member]) member . @ISIBLINGS(@PARENT("100"))). For example: Sales = @AVG(SKIPMISSING.Any valid single member name or member combination. if the current member of Measures being calculated is Margin. use @PARENT as a member rather than as an implied value of a cell.Sales)returns Central->Sales.). Notes You cannot use the @PARENT function in a FIX statement. You can use the @PARENT function on both the left and right sides of a formula. If you use this function on the left side of a formula in a calculation script. Syntax @PARENT(dimName [. 7 Member Set Functions Hyperion Essbase Calc Scripts @RANGE The @RANGE() function returns a member list that crosses the specified member from one dimension with the specified member range from another dimension.A valid member name. Assume that the Measures dimension contains an additional member. rangeList]) Optional rangeList . This example produces the following results: Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product 678 551 663 587 #MI 2479 Prod Count #MI #MI #MI #MI #MI 4 7-32 Hyperion . Syntax @RANGE(mbrName [. Prod Count.@CHILDREN(Product))). member set functions. and range functions from the same dimension. Examples The following example is based on the Sample Basic database. The @RANGE function is used with the @COUNT function to calculate the count of all products for which a data value exists: "Prod Count" = @COUNT(SKIPMISSING.@RANGE(Sales. Hyperion Essbase uses the level 0 members from the dimension tagged as Time. a comma-delimited list of member names. If rangeList is not specified. 200-10. Syntax @RDESCENDANTS(mbrName [. A value of 0 or a negative integer defines a level number. A positive integer defines a generation number. the result also includes either all descendants of each member being shared or descendants down to the specified generation or level. 100-30. 200. 200-30.Hyperion Essbase Calc Scripts Member Set Functions 7 @RDESCENDANTS The @IRDESCENDANTS function returns the specified member and all its descendants. Example Consider an outline with the following Product dimension: Product 100 100-10 100-20 100-30 200 200-10 200-20 200-30 200-40 Diet 100 (Shared Member) 200 (Shared Member) Diet has two children "100" and "200". genLevNum| genLevName]) genLevNum . 100-20. or those down to the specified generation or level. 200-20. Hyperion 7-33 .Level name or generation name down to which to select the members.An integer value that defines the absolute generation or level number down to which to select the members. @RDESCENDANTS(Diet) returns the members: 100. The members "100" and "200" are shared members. or genLevName . If one or more of the descendants are shared. 200-40 (in that order). 100-10. If a shared member is encountered. 7-34 Hyperion .7 Member Set Functions Hyperion Essbase Calc Scripts Notes In the absence of shared members. The order of members in the result list is important to consider when you use the @RDESCENDANTS and the @IRDESCENDANTS member set function with certain forecasting and statistical functions. Essbase generates the list of members in the following sequence: • • • The nearest descendant of the member The next nearest descendant of the member. @RDESCENDANTS and @DESCENDANTS return the same result. the above steps are repeated on the member being shared. and so on. -1) returns the two members that are at level 1 and that are below Profit: Margin and Total Expenses (in that order). @RELATIVE(Profit. Syntax @RELATIVE (mbrName. genLevNum | genLevName) Example In the Sample Basic database: @RELATIVE(Qtr1. Notes Hyperion Essbase sorts the generated list of members in ascending order.Hyperion Essbase Calc Scripts Member Set Functions 7 @RELATIVE The @RELATIVE function returns all members at the specified generation or level that are above or below the specified member in the database outline. Feb.0) both return the three members that are at generation 3 (or level 0) and that are below Qtr1 in the Sample Basic outline: Jan.3) @RELATIVE(Qtr1. and Mar. Hyperion 7-35 . This order is important to consider when you use the @RELATIVE member set function with certain forecasting and statistical functions. list2 . 7-36 Hyperion . Syntax @REMOVE (list1. New Hampshire. Example In the Sample Basic database. list2) list1 . from which the members specified in list2 are removed.7 Member Set Functions Hyperion Essbase Calc Scripts @REMOVE The @REMOVE() function removes values or members in one list from another list.A list of member specifications.@LIST("New York". @REMOVE(@CHILDREN(East).Connecticut)) returns Massachusetts. Florida.A list of member specifications to be removed from list1. Right siblings are children that share the same parent as the member and that follow the member in the database outline. Notes Essbase sorts the right siblings in ascending order. Hyperion 7-37 . This order is important to consider when you use the @RSIBLINGS member set function with certain forecasting and statistical functions. @RSIBLINGS(Sales) returns COGS .Hyperion Essbase Calc Scripts Member Set Functions 7 @RSIBLINGS The @RSIBLINGS() function returns all of the right siblings of the specified member. This function excludes the specified member. Syntax @RSIBLINGS(mbrName) Example In the Sample Basic database: @RSIBLINGS(Florida) returns Connecticut and New Hampshire. This order is important to consider when you use the @SIBLINGS member set function with certain forecasting and statistical functions. 200-40 (in that order). right siblings of the member (that is. California. Notes Essbase sorts the generated list of members as follows: • • left siblings of the member (that is. Syntax @SIBLINGS (mbrName) Example In the Sample Basic database: @SIBLINGS (Washington)returns Oregon. @SIBLINGS(East)returns West. 7-38 Hyperion . Using Sample Basic as an example. This function excludes the specified member. Essbase returns 200-20.7 Member Set Functions Hyperion Essbase Calc Scripts @SIBLINGS The @SIBLINGS() function returns all siblings of the specified member. siblings appearing below the member in the database outline) in ascending order. siblings appearing above the member in the database outline) in descending order. if you specify 200-30 for mbrName. Utah. and Nevada (in that order). and Central (in that order). South. 200-10. Hyperion Essbase Calc Scripts Member Set Functions 7 @UDA The @UDA function returns members with a common attribute. Notes You must type the UDA string exactly as it is shown in the database outline.User-defined attribute string as it is shown in the database outline. which have been defined as a user-defined attribute (UDA) on the Hyperion Essbase server. Hyperion 7-39 . udaStr) udaStr . Syntax @UDA (dimName."Small Market") This function returns a list of all members whose Market dimension has been assigned the UDA “Small Market”. Example @UDA(MARKET. in combination with the operator."IN".A value that. value) operator . The value can be an attribute member specification. and IN to specify conditions that must be met. "operator". 7-40 Hyperion . You can use operators such as >.Logical operator enclosed in quotation marks (""). in the Sample Basic database. defines the condition that must be met. value .7 Member Set Functions Hyperion Essbase Calc Scripts @WITHATTR The @WITHATTR() function returns all base members that are associated with an attribute that satisfies a specified condition. =. <. The following operators are supported: Operator > >= < <= == <> or != IN Meaning Greater than Greater than or equal to Less than Less than or equal to Equal to Not equal to In The IN operator returns the base members that are associated with a subcategory of attributes in the attribute dimension. For example. @WITHATTR(Population. or a date-format function. a constant.Medium) returns the base members that are associated with all attributes under the Medium parent member in the Population dimension. Syntax @WITHATTR (dimName. Hyperion Essbase Calc Scripts Member Set Functions 7 Examples The following table shows examples.000 is a constant @WITHATTR(Ounces. Marketing = Marketing * 1."16") Returns New York. you must use the @TODATE function in the string parameter to convert the date string to a number. based on the Sample Basic database: /* To increase by 10% the price of products that are greater than or equal to 20 ounces */ FIX (@WITHATTR(Ounces. Birch Beer. Grape."<>". Ohio @WITHATTR("Intro Date". Diet Cola."06-26-1996"))). Texas. Old Fashioned."18000000") @WITHATTR(Population. ENDFIX Notes If you specify a date attribute with the @WITHATTR function. Illinois.000."<".">".Can) @WITHATTR(Caffeinated. California.10000000) where 10. Old Fashioned Cola.">=". Sasparilla. Hyperion 7-41 . Diet Cream Caffeine Free Cola. Strawberry Massachusetts."<=".">"."= =".Medium) The following two examples show @WITHATTR used in a calc script. Illinois. Sasparilla Diet Cream Cola.1.">=". Texas New York. Ohio Cola. for each type of operator: Condition @WITHATTR(Population. Caffeine Free Cola."IN". Diet Cola."04-01-1996")) @WITHATTR("Pkg Type". Diet Cola.True) @WITHATTR("Population". ENDFIX /* To increase by 10% the marketing budget for products brought to market after a certain date */ FIX (@WITHATTR("Intro Date". @TODATE("mm-dd-yyyy".1. Orange. @TODATE("mm-dd-yyyy"."20")) Price = Price * 1. California. Florida. based on the Sample Basic database. Florida. "07-261996")) returns all base members with date attributes that are before July 26."<"."<"."<". Cranberry. When using Boolean attributes with @WITHATTR. 7-42 Hyperion ."<>". You cannot use True/Yes and False/No interchangeably.7 Member Set Functions Hyperion Essbase Calc Scripts Date @WITHATTR("Intro Date".True) returns all base members that have Caffeinated set to False (or No). which returns only base members with Caffeinated set to False.@TODATE("mm-dd-yyyy". The behavior is similar for a formula like @WITHATTR(Caffeinated. Boolean @WITHATTR(Caffeinated. An operator may work differently with different attribute types. but not Peach or Strawberry. for example. 1996. and Oat.True). Mango. use only the actual Boolean attribute member name. It does not return base members that do not have Caffeinated set to True (or Yes) or do not have a Caffeinated attribute at all.Orange) returns base members with attributes that precede Orange in the alphabet. Apple. For example: Text @WITHATTR(Flavors. or use 1 (for True or Yes) or 0 (for False or No). @MAXSRANGE. @SUMRANGE. 2000->Jan. March->2001) is invalid. 2001->Mar Notes @XRANGE can appear anywhere in a formula where a range can normally appear. @XRANGE(1998->Jun. @SPLINE The two arguments to @XRANGE must be either single members or crossdimensional members with the same member components. @MOVMED. It determines the cross product of all members in the range and then prunes the set to include only the range requested. 2000->Feb. 2001) is invalid. @XRANGE(1998->Jun. @MINRANGE. 1998->Dec.. mbrName2) Examples This function is useful. @STDDEVRANGE. .. @XRANGE(1998->Aug. . 2001->Qtr1) is invalid.. Although the syntax is correct. @MOVSUM. Hyperion 7-43 . @XRANGE can be used only in these functions: @AVGRANGE. The member components of each argument must be from the same level. 2001->Feb. For example. 1998->Sep.. 1999->Jan. @MINSRANGE. @XRANGE(1998->Jun.. For example. 2001->March) This example returns the set consisting of: 1998->Aug. 1998) results in an empty set. a function such as @XRANGE (2001. 1999->Dec. 2000->Dec. Syntax @XRANGE (mbrName1. 2001->Jan.. 1999->Feb. for example. @MOVMAX.Hyperion Essbase Calc Scripts Member Set Functions 7 @XRANGE @XRANGE takes as input two members (single or cross-dimensional) and returns a member range. @MOVAVG. For example. The dimension order of members must match for both arguments. @MOVMIN. @MAXRANGE. . when you work with the Time and Scenario dimensions. Close the spreadsheet. This calc script should apply only to the Budget. The calc script should calculate all Accounts members. Retrieve into this sheet. Perform a retrieval and notice the calculation results within the pink cells. you create a calc script to calculate all members within East. Save the new script as CSMember. including the East total. For this exercise. and all Products members.7 Member Set Functions Hyperion Essbase Calc Scripts Exercise 7-1: Applying Member Set Functions In this exercise. including the East total. 3) 4) 5) 6) 7) 8) 7-44 Hyperion . Lock and send the data in the Lock&Send sheet to the HLandS1 database. clear all data from the HLandS1 database. all Time members. Create a calc script to calculate Budget values for all members within East. Notice that the values in pink have not been calculated yet. Open the SS_Member spreadsheet. From the Calc&Retrieve sheet.xls 1) 2) From Essbase Application Manager. Do the pink cells beneath Connecticut and East contain data after the calculation? Why or why not? If they do not. and all Products members. Switch to the Calc&Retrieve sheet. The calc script should calculate all Accounts members. all Time members. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSMember SS_Member. run the CSmember calc script. modify the CSMember calc script and rerun the calculation until all pink cells are populated with data. Hyperion Essbase Calc Scripts Member Set Functions 7 Unit Summary To avoid hard-coding lists of members or dimensions. for example. you use member set functions. The member set functions are often used in conjunction with Fix structures to isolate specific members for which calculations are to be performed. an associated calc script need not change. when the database structure changes by adding members. Hyperion 7-45 . Member set functions return lists of members and dimensions. Therefore. and East.7 Member Set Functions þ Check Your Understanding 1) Hyperion Essbase Calc Scripts Now that you have completed the chapter. All level one members of the Market Dimension. “New York” and all its ancestors. 7-46 Hyperion . Use the Sample Basic outline. itself.000. All the states in the East market. identify the Member Set function that you would use to create a list of the required members. All states whose population is greater than 6. All states that begin with the letter “N”.000. check your understanding by responding to the following questions: For each of the following situations. itself. identify the Member Set function that you would use to create a list of the required members. All states whose population is greater than 6. All level one members of the Market Dimension.Hyperion Essbase Calc Scripts Member Set Functions 7 þ Check Your Understanding Solutions 1) For each of the following situations. Use the Sample Basic outline.) @MATCH @ICHILDREN or @IDESCENDANTS @LVLMBRS @IANCESTORS @WITHATTR All states that begin with the letter “N”. (Multiple solutions may be correct for some of these answers.000.000. Hyperion 7-47 . All the states in the East market. “New York” and all its ancestors. and East. 7 Member Set Functions Hyperion Essbase Calc Scripts 7-48 Hyperion . you will be able to: • • Explain the purpose and use of relationship functions to generate member lists Practice using the relationship functions in a series of incremental exercises .8 Relationship Functions Chapter Objectives By the end of this chapter. The simpler outline includes: Market East Region .Connecticut West Region . genLevNumX. simpler outline are used to explain how relationship functions work. In this chapter. 8-2 Hyperion .. dimName1.California -..Albany -.Group 01-1 -. the Sample Basic outline and a second.SKU01-1-1 --SKU01-1-2 . A positive integer defines a generation number..Group 01-2 -.Los Angeles -.SKU01-2-1 -. dimNameX mbrName.New York State -. genLevNum.Buffalo . genLevNum1.SKU01-2-2 Relationship Function Parameters There are common parameters associated with the various relationship functions: dimName. Single dimension name specification. Any valid single member name or member combination (or a function that returns a single member or member combination). An integer value that defines the generation or level number from which the ancestor value is returned.8 Relationship Functions Hyperion Essbase Calc Scripts Using Relationship Functions A relationship function returns a value based on the member combination being calculated and the degree of relationship specified by the function.San Francisco Product Family01 . A value of 0 or a negative integer defines a level number. Each function is also described. Function @ANCESTVAL Returns The value of a specified ancestor of the current member being calculated. Values incorporated from a different Essbase database. in detail. @ATTRIBUTEBVAL @ATTRIBUTESVAL @ATTRIBUTEVAL @CURGEN @CURLEV @GEN @LEV @MDANCESTVAL @MDPARENTVAL @PARENTVAL @SANCESTVAL @SPARENTVAL @XREF Hyperion 8-3 . Parent-level data based on the shared parent value of the current member being calculated. The level number of the current member combination for the specified dimension. The generation number of the current member combination for the specified dimension. The associated attribute value from the specified numeric or date attribute dimension. Multi-dimensional ancestor-level value for the current member being calculated. The associated attribute value from the specified string attribute dimension. in this chapter. The level number of the specified member.Hyperion Essbase Calc Scripts Relationship Functions 8 Summary of Relationship Functions This table summarizes the Relationship Functions. The associated attribute value from the specified boolean attribute dimension. Multi-dimensional parent-level data for the current member being calculated. The parent value along the specified dimension for the member being calculated Ancestor-level data based on the shared ancestor value of the current member being calculated. The generation number of the specified member. @ANCESTVAL(Market.5 52.9 25. this function returns the value of East->Sales. mbrName]) Notes The returned value will be the value for the specified generation (or level) of the dimension and member combination.8 Relationship Functions Hyperion Essbase Calc Scripts @ANCESTVAL The @ANCESTVAL() function returns the ancestor values of a specified member combination.Family01 510 520 1030 430 500 930 1960 SKU Share 26.Sales) refers to the Sales value of generation 2 of the current member’s Market hierarchy.2. this function returns the value of “New York State”->Sales.2. "SKU Share" = Sales % @ANCESTVAL(Product. For example.5 21.Sales) refers to the Sales value of level 1 of the current member’s Market hierarchy.0 26.4 100. For the Albany of illustrative outline. genLevNum [. Syntax @ANCESTVAL (dimName.Group01-1 SKU01-2-1 SKU01-2-2 . @ANCESTVAL(Market. Example In this example.Group01-2 --. Consolidated results must be calculated for Sales by Product before the SKU Share calculation occurs.00 8-4 Hyperion . Families are at generation 2. For the Albany of illustrative outline.5 47. each descendant of family is calculated as a percentage its specific generation 2 ancestor. therefore.Sales). SKU Share is derived by taking Sales in each SKU as a percentage of its product family. This example produces the following results: Sales SKU01-1-1 SKU01-1-2 .-1. Caffeinated. as shown in the following example: Product {Caffeinated} 100 100-10 {Caffeinated:True} 100-20 {Caffeinated:True} 100-30 {Caffeinated:False} 200 200-10 {Caffeinated:True} 200-20 {Caffeinated:True} 200-30 {Caffeinated:False} 200-40 {Caffeinated:False} Caffeinated Attribute {Type: Boolean} True False For the current member of the base dimension Product. Example The Product dimension is associated with the Caffeinated Boolean attribute dimension. the @ATTRIBUTEBVAL() function returns the associated attribute value from the specified Boolean attribute dimension. the function @ATTRIBUTEBVAL(Caffeinated) returns the associated attribute value from the Boolean attribute dimension.The name of a Boolean attribute dimension. The following table shows the value that would be returned: Current Member 100-10 100-20 100-30 100 Return Value True True False #MISSING Hyperion 8-5 . Syntax @ATTRIBUTEBVAL(attDimName) attDimName .Hyperion Essbase Calc Scripts Relationship Functions 8 @ATTRIBUTEBVAL For the current member being calculated. or date attribute. numeric. If no attribute is associated with the member being calculated or if the attribute associated with the member is a text. 8-6 Hyperion . Only level 0 members of attribute dimensions can be associated as attributes of members of a base dimension. @ATTRIBUTEBVAL returns #MISSING.8 Relationship Functions Hyperion Essbase Calc Scripts 200-10 200-20 200-30 200-40 200 Product True True False False #MISSING #MISSING Notes The @ATTRIBUTEBVAL function works only with Boolean attribute dimensions. The following table shows the value that would be returned: Current Member 100-10 100-20 100-30 100 Return Value Can Can Bottle (empty string) Hyperion 8-7 .Hyperion Essbase Calc Scripts Relationship Functions 8 @ATTRIBUTESVAL For the current member being calculated. Product. Syntax @ATTRIBUTESVAL(attDimName) attDimName . Example This example is based on the Sample Basic database.The name of a text attribute dimension. Pkg Type. The Product dimension is associated with the Pkg Type text attribute dimension. the @ATTRIBUTESVAL() function returns the associated attribute value from the specified text attribute dimension. as shown in the following example: Product {Pkg Type} 100 100-10 {Pkg 100-20 {Pkg 100-30 {Pkg 200 200-10 {Pkg 200-20 {Pkg 200-30 {Pkg 200-40 {Pkg Pkg Type Attribute Bottle Can Type:Can} Type:Can} Type:Bottle} Type:Bottle} Type:Bottle} Type:Bottle} Type:Bottle} {Type: Text} For the current member of the base dimension. the function @ATTRIBUTESVAL("Pkg Type") returns the associated attribute value from the text attribute dimension. If no attribute is associated with the member being calculated or if the attribute associated with the member is a numeric. Only level 0 members of attribute dimensions can be associated as attributes of members of a base dimension.8 Relationship Functions Hyperion Essbase Calc Scripts 200-10 200-20 200-30 200-40 200 Product Bottle Bottle Bottle Bottle (empty string) (empty string) Notes The @ATTRIBUTESVAL function works only with text attribute dimensions. @ATTRIBUTESVAL returns an empty string. or date attribute. 8-8 Hyperion . Boolean. When the @ATTRIBUTEVAL function is used with a date attribute dimension.Single dimension specification for a numeric or date attribute dimension. For example. 1970. Hyperion 8-9 . if the member being calculated is Cola and if the Ounces attribute value associated with Cola is 12. @ATTRIBUTEVAL returns the associated attribute from the Ounces numeric attribute dimension. @ATTRIBUTEVAL returns #MISSING. If there is no attribute associated with the member being calculated.75 Cola Notes The @ATTRIBUTEVAL function works only with numeric and date attribute dimensions. Example The following example is based on the Sample Basic database: "Profit Per Ounce" = Profit/@ATTRIBUTEVAL(Ounces). @ATTRIBUTEVAL returns 12. Essbase converts the date string to the number of seconds elapsed since midnight. This example produces the following results: Profit ======== 4593 Profit Per Ounce ================ 382. Only level 0 members of attribute dimensions can be associated as attributes of members of a base dimension. In this formula.Hyperion Essbase Calc Scripts Relationship Functions 8 @ATTRIBUTEVAL For the current member being calculated. January 1. or if the attribute associated with the member is a text attribute. Syntax @ATTRIBUTEVAL(attDimName) attDimName . the @ATTRIBUTEVAL() function returns the associated attribute value from the specified numeric or date attribute dimension. for the current member being calculated. 8 Relationship Functions Hyperion Essbase Calc Scripts @CURGEN The @CURGEN() function returns the generation number of the current member combination for the specified dimension. This number represents the number of members separating the current member from the top-most member of the dimension. Syntax @CURGEN(dimName) Example In the Sample Basic database: @CURGEN(Year)produces the following results: Current Member Year Qtr2 Oct Value 1 2 3 8-10 Hyperion . This number represents the number of members that separates the current member from its bottommost descendant. Syntax @CURLEV(dimName) Example In the Sample Basic database: @CURLEV(Year) produces the following results: Current Member Year Qtr3 Aug Value 2 1 0 Hyperion 8-11 .Hyperion Essbase Calc Scripts Relationship Functions 8 @CURLEV The @CURLEV() function returns the level number of the current member combination for the specified dimension. 8 Relationship Functions Hyperion Essbase Calc Scripts @GEN The @GEN() function returns the generation number of the specified member. Syntax @GEN(mbrName) Example In the Sample Basic database: @GEN(Year) @GEN(Qtr3) 1 2 8-12 Hyperion . Syntax @LEV(mbrName) Example In the Sample Basic database: Function @LEV(Margin) @LEV("New York") Level Returned 1 0 Hyperion 8-13 .Hyperion Essbase Calc Scripts Relationship Functions 8 @LEV The @LEV() function returns the level number of the specified member. Product. Notes @MDANCESTVAL(2. 2. Sales) refers to the Sales value found by navigating to generation 2 of the current member’s Market hierarchy and to generation 2 of the current member’s Product hierarchy. Market. 2. Product.8 Relationship Functions Hyperion Essbase Calc Scripts @MDANCESTVAL The @MDANCESTVAL() function returns ancestor-level data from multiple dimensions based on the current member being calculated. The Marketing Expense data must be allocated down to each Product code and city based on Sales. Market. dimName1. 2. which produces the following (partial) results: Sales Albany SKU01-1-1 SKU01-1-2 SKU01-2-1 SKU01-2-2 East Region Family01 300 200 400 100 2000 Marketing 60 40 80 20 400 8-14 Hyperion . dimNameX. this function returns the value of “East Region”->Family01->Sales.mbrName]) dimCount . The Marketing Expense value of 400 for East Region and product Family01 is allocated down to each Product code and city with the following formula: Marketing = (Sales / @MDANCESTVAL(2. Marketing). Market. Product. genLevNumX [. 2. 2. You must specify a genLevNum for every dimName specified.Integer value that defines the number of dimensions from which ancestor values are being returned. For the Albany->SKU01-1-2 of illustrative outline.. 2. Syntax @MDANCESTVAL(dimCount. Example Marketing expenses are captured at the Product Family and Region level in a product planning application.. Sales)) * @MDANCESTVAL(2. genLevNum1. Integer value that defines the number of dimensions from which parent values are being returned. dimName1. which produces the following (partial) results: Sales New York State Group01-1 Group01-2 Connecticut Group01-1 Group01-2 East Region Family01 300 200 100 400 1000 Marketing 60 40 20 80 200 Hyperion 8-15 . The Marketing Expense value of 200 for East Region and product Family01 is allocated down to each Product code and city with the following formula: Marketing = (Sales / @MDPARENTVAL(2. The Marketing Expense data must be allocated down to each Product Group Code and state based on Sales. Notes @MDPARENTVAL(2. For the Albany->SKU01-1-2 of illustrative outline. Example Marketing expenses are captured at the Product Family and Region level in a product planning application. this function returns the value of “New York State”>Group01-1->Sales.Hyperion Essbase Calc Scripts Relationship Functions 8 @MDPARENTVAL The @MDPARENTVAL() function returns parent-level data from multiple dimensions based on the current member being calculated. Market.. Product. Marketing). dimNameX [.. Market. Product..mbrName]) numDim . Market. Sales) refers to the Sales value found by navigating to the current member’s parent in Market hierarchy and to the parent in Product hierarchy. Syntax @MDPARENTVAL(numDim. Sales)) * @MDPARENTVAL(2. Product. this function returns the value of “New York State”->Sales. mbrName]) Notes The returned value will be that of the parent along the specified dimension and member combination. Syntax @PARENTVAL (dimName [. For example.Sales).Sales) refers to the Sales value of the parent of the current member’s Market hierarchy. Example The formula calculates Market Share Sales value for each Market member as a percentage of Sales for its Market dimension parent. @PARENTVAL(Market. For Albany of illustrative outline.8 Relationship Functions Hyperion Essbase Calc Scripts @PARENTVAL The @PARENTVAL() function returns the parent value along the specified dimension for the member being calculated. produces the following results: Sales Albany Buffalo New York State Los Angeles San Francisco California Market 360 240 600 1000 100 300 400 60 40 60 100 Market Share 25 75 40 8-16 Hyperion . "Market Share" = Sales % @PARENTVAL(Market. mbrName]) rootMbr .Defines a member that is used to search for the nearest occurrence of an ancestor of a shared member.Hyperion Essbase Calc Scripts Relationship Functions 8 @SANCESTVAL The @SANCESTVAL() function returns ancestor-level data based on the shared ancestor value of the current member being calculated. The following Product hierarchy is defined: Product 100 100-10 100-20 200 200-10 200-20 Diet ~ 100-10 SHARED 200-10 SHARED Caffeine Free ~ 100-20 SHARED 200-20 SHARED Hyperion 8-17 .genLevNum [. Syntax @SANCESTVAL (rootMbr. The Marketing Expense data must be allocated down to each Product code based on Sales contribution. The Product categories are defined as ancestors that contain shared members as children. Example Marketing expenses are captured at the Product Category levels in a product planning application. 8 Relationship Functions Hyperion Essbase Calc Scripts The Marketing Expense value is allocated down to each Product code with the following formula: Marketing = (Sales / @SANCESTVAL(Product.5 26.7 40 100 400 900 37. Marketing).5 50 300 200 500 12. 8-18 Hyperion . 2.5 12.5 13.3 #Missing Notes The time required for retrieval and calculation may be significantly longer if this function is in a formula attached to a member tagged as Dynamic Calc or Dynamic Calc and Store. 2. which produces the following result: Sales 100-10 100-20 100 200-10 200-30 200 100-10 200-10 Diet 100-20 200-30 Caffeine Free 200 400 600 300 100 400 13. Sales)) * @SANCESTVAL(Product.7 #Missing Marketing 37.3 26. Sales)) * @SPARENTVAL(Product. The Product categories are defined as parents that contain shared members as children. Marketing). Example Marketing expenses are captured at the Product Category (Diet and Caffeine Free) levels in a product planning application. Syntax @SPARENTVAL(RootMbr [.Defines a member that is used to search for the nearest occurrence of a parent of a shared member.Hyperion Essbase Calc Scripts Relationship Functions 8 @SPARENTVAL The @SPARENTVAL() function returns parent-level data based on the shared parent value of the current member being calculated.0). Marketing = (Sales / @SPARENTVAL(Product. The Marketing Expense data must be allocated down to each Product code based on Sales contribution. The following Product hierarchy is defined: Product 100 100-10 100-20 200 200-10 200-20 Diet ~ 100-10 200-10 Caffeine Free ~ 100-20 200-20 SHARED SHARED SHARED SHARED The Marketing Expense value is allocated down to each Product code with the following calc script: FIX (@LVLMBRS(Products. Hyperion 8-19 . ENDFIX. mbrName]) RootMbr . 7 #Missing 37.5 50 13.5 26.7 40 Notes The time required for retrieval and calculation may be significantly longer if this function is in a formula attached to a member tagged as Dynamic Calc or Dynamic Calc and Store.5 12.3 26.8 Relationship Functions which produces the following result: Sales 100-10 100-20 100 200-10 200-30 200 100-10 200-10 Diet 100-20 200-30 Caffeine Free 200 400 600 300 100 400 100 400 900 300 200 500 Hyperion Essbase Calc Scripts Marketing 37.5 13. 8-20 Hyperion .3 #Missing 12. How @XREF works The @XREF function retrieves values from a data source to be used in a calculation on a data target. This database may be remote (that is. and password. mbrList]) locationAlias . Location aliases are set by the database administrator at the database level using Essbase Application Manager. database. ESSCMD. The location alias specifies a server. mbrList .A comma-delimited list of member names that qualify the @XREF query. The data source then constructs a member combination. the member combination that identifies the left hand side of a calculation).A location alias for the data source. Point of view: the member combination currently being calculated on the data target (that is. The data source and data target outlines can be different. Data source: the database that is queried by the @XREF function. username. possibly remote database. The data source is described by a location alias. The members you specify for mbrList are sent to the data source in addition to the members in the current point of view in the data target.Hyperion Essbase Calc Scripts Relationship Functions 8 @XREF The @XREF function is a cross-database function that allows a calculation taking place in one Essbase database to incorporate values from a different. The following terminology is used to describe the @XREF function: Data target: the database on which the current calculation is running (that is. using in order of precedence: • • • The members specified in mbrList The members in the current point of view The top member in any unspecified dimensions in the data source Hyperion 8-21 . Syntax @XREF (locationAlias [. application. or the API. on a different machine than the data target). the database on which the @XREF call originates). consider the following two databases: Main Database Year Qtr1 Qtr2 Measures Sales Units Product 100 100-10 100-20 Market East West Scenario Budget Forecast Inflation Rates Database (Location Alias: InflatDB) Year Qtr1 Qtr2 Assumptions Inflation Deflation = Inflation * . In this example.Inflation.8 Relationship Functions Hyperion Essbase Calc Scripts Example 1 For this example.5 (Dynamic Calc) Country US Canada Europe The following formula is associated with the Main Database: Units = Units * @XREF(InflatDB. Essbase calculates the following member combinations: Units->Qtr1->100-10->East->Budget = Units->Qtr1->100-10->East>Budget * Inflation->Qtr1->US Units->Qtr2->100-10->East->Budget = Units->Qtr2->100-10->East>Budget * Inflation->Qtr2->US and so on.US). 8-22 Hyperion . For example. California.0)). and pulls Sales->January from sourceDB. If the cube on the data source (sourceDB) contains data only from 1998. 8-23 . However. while the data source (sourceDB) contains the member January. The number of data cells queried on the data source must match the number of data cells expected on the data target. consider the following formula: West->Inventory = @XREF(SourceDb.Dec). the following formula is not valid: West->Inventory = @XREF(SourceDb. Hyperion H H H H This formula would return two data values. since the current point of view calls for only one data cell Inventory->West. Oregon). Assume that the data target contains the member Jan.January).Hyperion Essbase Calc Scripts Relationship Functions 8 Example 2 The following formula modifies the point of view on the data target: 1999->Jan->Inventory = @XREF(sourceDB. This formula simply maps the member in the data target (Jan) with its corresponding member in the data source (January). the following formula is not valid: West->Inventory = @XREF(SourceDb. one for Inventory in California and one for Inventory in Oregon. this formula sets Inventory for Jan in 1999 to the Inventory value for Dec from 1998. For example. Jan:Mar). Essbase returns an error message. The member list cannot contain ranges. For example. Notes Essbase returns an error message if the members supplied in mbrList do not exist in the data source. The member list cannot contain functions that return more than one member. @LEVMBRS(Market. Example 3 The following formula defines a specific point of view on the data target: Sales->Jan = @XREF(sourceDB. @XREF can query all types of members supported by the Essbase server. data in the source database may change. select the application and database that accesses the source data (that is. For example. @XREF does not incorporate changes made after the beginning of the calculation. the following formula would calculate the sum of the sales of all red products and would assign the result to member RedThings: RedThings->Sales = @XREF(SourceDb. For example. To define a location alias: In the server window of the Essbase Application Manager. A location alias is set at the database level and specifies the server. Average). members retrieved from a data source can be Dynamic Calc members as well as attribute members. Defining a Location Alias The @XREF command uses a location alias name to identify the data source. Red. the data target). Keep in mind that all performance considerations that apply to dynamic and attribute calculations also apply to @XREF queries that depend on dynamic and attribute members. if the data source classifies products based on a color attribute. Red). 8-24 H H H H 1) mbrList can contain attribute operators.8 Relationship Functions Hyperion Essbase Calc Scripts mbrList can contain attribute members. Hyperion . the following formula calculates RedThings as the average sales of all red products: RedThings->Sales = @XREF(SourceDb. For example. application. username and password to be assigned to the alias name. You need database designer privileges to maintain location alias definitions. Over the course of an @XREF calculation. Hyperion Essbase Calc Scripts 2) Relationship Functions 8 Select Database / Location Aliases. The Location Aliases dialog displays: 3) 4) 5) In the Alias text box. Use the Alias name in the @XREF formula. type the alias name for the remote database. The location alias is added to the alias list: 6) 7) 8) 9) Click OK. ✍ Hyperion 8-25 . type the application name for the remote database. type the database name for the remote database. Type the User name and Password in the respective text boxes. In the Server text box. type the server name or IP address for the remote database. In the Application text box. Click Set. In the Database text box. modify the CSAncest calc script and rerun the calculation until all pink cells are populated with correct results. 2000 Product Family). Retrieve from the Essbase database into this sheet. Notice that the values in the “Check your results” column are not calculated. Corporate Expenses are loaded at the product family level (for example. you create a calc script that allocates Corporate Expenses for all individual products. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSAncest SS_Ancest. based on percentage of individual product sales to total sales. These corporate expenses are to be allocated to each product. Close the spreadsheet. Open the SS_Ancest spreadsheet. Are the values in the “Check your results” column the same as the retrieved results? If not. For this exercise. Retrieve from the Essbase database into this sheet. Create a calc script to allocate Corporate Expenses for all individual products to each product.xls 1) 2) From Essbase Application Manager. run the CSAncest calc script. Lock and send the data in the Lock&Send sheet to the HLandS1 database. Save the new script as CSAncest.8 Relationship Functions Hyperion Essbase Calc Scripts Exercise 8-1: Applying Relationship Function (@ANCESTVAL) In this exercise. 1000 Product Family. clear all data from the HLandS1 database. From the Calc&Retrieve sheet. 3) 4) 5) 6) 7) 8) 9) 8-26 Hyperion . Switch to the Calc&Retrieve sheet. based on percentage of individual product sales to total sales. For this exercise. Save the new script as CSCrmbr. clear all data from the HLandS2 database. The average inventory for a Market member is calculated by averaging the ending inventory for each child member of that Market member. you create a calc script that calculates the average inventory for each market. run the CSCrmbr calc script. From the Calc&Retrieve sheet. Create a calc script to calculate the average inventory for each market.Hyperion Essbase Calc Scripts Relationship Functions 8 Exercise 8-2: Applying Relationship Function (@CHILDREN) In this exercise. Switch to the Calc&Retrieve sheet. Retrieve into this sheet. Close the spreadsheet. Lock and send the data in the Lock&Send sheet to the HLandS1 database. 3) 4) 5) 6) 7) 8) Hyperion 8-27 . The average inventory for a Market member is calculated by averaging the ending inventory for each child member of that Market member. Perform a retrieval. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSCrmbr SS_Currmbr.xls 1) 2) From Essbase Application Manager. modify the CSCmbr calc script and rerun the calculation until these values are correct. Open the SS_Currmbr spreadsheet. Are the results in the “Average Inventory” column as expected? If not. Notice that the values “Average Inventory” column are #Missing. the costs of goods sold as percentage of that product's sales... which have been loaded at the Product level. The COGS database contains.8 Relationship Functions Hyperion Essbase Calc Scripts Exercise 8-3: Applying Relationship Function (@XREF) In this exercise. select CALC:HLANDS1. From the main menu. Alias Server Application Database User name Password Type.xls 1) 2) From Essbase Application Manager. For this exercise. Set up Location Alias 3) 4) In the server window. type the following: In Field. select Database / Location Aliases. In the Location Aliases window. you create a calc script that calculates the Cost of Goods Sold for individual products. The actual cost of goods is then calculated by multiplying these COGS percentages by the actual sales amounts. 8-28 Hyperion . COGS Localhost CALC COGS trnadmin Hyperion 5) 6) Click OK.. Review the structure of the Calc:COGS database. The Location Aliases window displays. for each product.. you use the following files: Database CALC:HLandS1 CALC:COGS Calc Script (new) Spreadsheet CSXref SS_Xref. clear all data from the HLandS1 database. Lock and send the data in the Lock&Send sheet to the HLandS1 database. Notice that the values in the COGS column display #Missing. Are the results in the COGS column as expected? If not. The Actual cost of goods is calculated by multiplying the COGS percentages (found in the COGS database) by the Actual Sales amounts. Test the Calc Script 8) 9) Open the SS_Xref spreadsheet. Close the spreadsheet. Perform a retrieval and notice the results in the COGS column. From the Calc&Retrieve sheet. 10) 11) 12) 13) Hyperion 8-29 . which have been loaded at the Product level. run the CSXref calc script. Switch to the Calc&Retrieve sheet.Hyperion Essbase Calc Scripts Relationship Functions 8 Create the Calc Script 7) Create a calc script for the HLandS1 database to calculate the Cost of Goods Sold for individual products. Retrieve into this sheet. modify the CSXref calc script and rerun the calculation until these values are correct. Save the new script as CSXref. these functions are dependent on the current member's position. You can use these functions to refer to another value in a data series.8 Relationship Functions Hyperion Essbase Calc Scripts Unit Summary Relationship functions look up specific values within the database based on current cell location and a series of parameters. 8-30 Hyperion . that is. Relationship functions have an implicit current member argument. check your understanding by responding to the following questions: 1) For each of the following situations. For current member “Diet Cola”->Massachusetts. The level number of the current member. the value of 100->East. Use the Sample Basic outline. the value of 100->Massachusetts. identify the Relationship function that you would use to retrieve the required value.) The value of the Population attribute for the current member. A value from another database. Hyperion 8-31 . (Multiple solutions may be correct for some of these answers. For current member “Diet Cola”->Massachusetts.Hyperion Essbase Calc Scripts Relationship Functions 8 þ Check Your Understanding Now that you have completed the chapter. identify the Relationship function that you would use to retrieve the required value. @MDPARENTVAL @XREF @CURLEV @PARENTVAL 8-32 Hyperion . For current member “Diet Cola”->Massachusetts.) @ATTRIBUTEVAL The value of the Population attribute for the current member. (Multiple solutions may be correct for some of these answers. the value of 100->East. The level number of the current member. Use the Sample Basic outline. For current member “Diet Cola”->Massachusetts.8 Relationship Functions þ Check Your Understanding Solutions 1) Hyperion Essbase Calc Scripts For each of the following situations. the value of 100->Massachusetts. A value from another database. you will be able to: • • Explain the purpose and use of Range and Financial Functions to generate member lists Practice using the Range and Financial Functions in a series of incremental exercises .9 Range and Financial Functions Chapter Objectives By the end of this chapter. these functions calculate a series of values internally based on the range specified. they internally calculate a series of values based on the range specified and write the results to a range of cells. SKIPNONE . or range functions from the same dimension.Ignores all 0 and #MISSING values dimName. Rather than return a single value. A value of 0 or a negative integer defines a level number. When an optional parameter.9 Range and Financial Functions Hyperion Essbase Calc Scripts Using Range and Financial Functions Range functions take a range of members as an argument.Ignores all 0 values SKIPBOTH . member set functions. 9-2 Hyperion . across which the accumulation occurs. you cannot apply any operator directly to the function. Optional comma-delimited list of members.Ignores all #MISSING values SKIPZERO . Essbase uses the level 0 members from the dimension set as Time. A positive integer defines a generation number.Includes in the operation all values specified in expList regardless of their content SKIPMISSING . Thus. SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH Used in conjunction with an expList. if rangeList is not specified. rather. Range and Financial Function Parameters There are common parameters associated with the various Range and Financial Functions: mbrName rangeList Specifies a single member. Financial functions never return a value. Single dimension name specification. DimNameX genLevNum An integer value that defines the generation or level number from which the ancestor value is returned. dimName1. this parameter indicates how missing and zero values are to be processed. Function @ACCUM Returns Accumulated total values across the specified range.Hyperion Essbase Calc Scripts Range and Financial Functions 9 Summary of Range and Financial Functions This table summarizes the Range (and Financial) Functions. The accumulation of principal and interest on a single payment over time. The maximum value of the specified member across the specified range of members allowing for skipping of #MISSING and/or 0 values. The discounted value at the beginning of the first period for amounts at end each period. Each function is also described. in this chapter. The minimum value of the specified member across the specified range of members. The maximum value of the specified member across the specified range of members. The Internal Rate of Return on a cash flow. The depreciation amount per period that an asset may be depreciated using the declining balance method. Amount of compound interest on a series of periodic deposits. A member list based on the relative position of the current member being calculated. @AVGRANGE @COMPOUND @COMPOUNDGROWTH @CURRMBRRANGE @DECLINE @DISCOUNT @GROWTH @INTEREST @IRR @MAXRANGE @MAXSRANGE @MDSHIFT @MINRANGE Hyperion 9-3 . The average value of the specified member across the specified range. in detail. A series of values that represent a linear growth of an initial value across the specified range. A series of data values that are copied from shifted multiple dimension ranges. The amount of simple interest of a value at the specified rate. The period-to-date values of members in the dimension tagged as Time. The specified subsequent or previous cell value of the range for the specified member. The amount per period that an asset in the current period may be depreciated using the sum of the years’ digits method. The specified subsequent cell value of the range for the specified member providing the option to skip #MISSING and/or zero values. The specified subsequent cell value of the range for the specified member providing the option to skip #MISSING and/or zero values. The specified subsequent cell value of the range for the specified member. @NEXT @NEXTS @NPV @PRIOR @PRIORS @PTD @SHIFT @SLN @SUMRANGE @SYD 9-4 Hyperion .9 Range and Financial Functions Hyperion Essbase Calc Scripts Function @MINSRANGE Returns The minimum value of the specified member across the specified range of members allowing for skipping of #MISSING and/or 0 values. The specified previous cell value of the range for the specified member. The amount per period that an asset in the current period may be depreciated using a straight-line depreciation method. The Net Present Value of an investment based on the series of payments and income. The summation of all the values of the specified member across the specified range. This example produces the following results: FY1990 FY1991 FY1992 FY1993 FY1994 FY1995 Asset Accum_Asset 9. @SIBLINGS).Hyperion Essbase Calc Scripts Range and Financial Functions 9 @ACCUM The @ACCUM() function accumulates the values of mbrName within rangeList. Hyperion 9-5 . up to the current member in the dimension of which rangeList is a part.000 0 1. to ensure correct results. Accum_Asset is calculated using the following formula: "Accum Asset" = @ACCUM(Asset.000 The results show that the values for Asset are accumulated starting with FY1992 and the accumulated values are placed in Accum_Asset for FY1992 through FY1995: Notes @ACCUM accepts the @ATTRIBUTE member set function as a member range.000 #MI 0 #MI 1.000 1.500 3. consider the order in which Essbase sorts the generated member list. FY1992:FY1995).500 1. rangeList]) Example In this example.000 2.500 5. If you use a Essbase member set function to generate a member list for the rangeList parameter (for example. Syntax @ACCUM (mbrName [. Syntax @AVGRANGE(SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH.Sales. mbrName [. rangeList]) Example The following example is based on the Sample Basic database.@CHILDREN(West)). 9-6 Hyperion . This example produces the following (partial) results: Jan California Oregon Washington Utah Nevada West 100 200 300 400 500 300 Feb 100 200 300 400 #Missing 200 Mar 100 200 0 400 500 240 Notes The @AVGRANGE function accepts the @ATTRIBUTE member set function as a member range.9 Range and Financial Functions Hyperion Essbase Calc Scripts @AVGRANGE The @AVGRANGE() function returns the average value of the specified member across the specified range. West=@AVGRANGE(SKIPNONE. 0525 0 0 FY1992 0. based on a credit rate of 0.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @COMPOUND The @COMPOUND() function compiles the amount of a compound interest based on the balances of the specified member at the specified rate across the specified range.0525 2. or a range.If rangeList is not specified. This is equivalent to entering the value in the first member in the rangeList followed by zeros.Single member specification representing the beginning balance across a range of periods. Syntax @COMPOUND(balanceMbr. then Essbase assumes balanceMbr to be a single deposit in the first member of rangeList. Essbase uses the level 0 members from the dimension tagged as Time."Credit Rate". rangeList]) balanceMbr .5125 FY1994 0. then it is assumed to be a series of deposits.1897 Notes If balanceMbr is a single value.FY1991:FY1995).0525 3.0525 0 288. across a series of fiscal years: "Compound Interest"= @COMPOUND(Deposit.000 273. or numeric expression in decimal form that represents the interest rate per time period specified in the rangeList. rangeList represents the range over which the interest is compounded. variable name.0525. If balanceMbr is a member. rateMbrConst . This example produces the following results: FY1991 Credit Rate Deposit Compound Interest 0.000 105 FY1993 0.Single member specification. Example The following example determines the compound interest of a series of deposits. rateMbrConst [.8144 FY1995 0. Hyperion 9-7 .0525 0 110. 83 0.10 0.71 Notes You can change the growth rate from period to period by placing a nonzero value in the current period's rateMbrConst cell.9 Range and Financial Functions Hyperion Essbase Calc Scripts @COMPOUNDGROWTH The @COMPOUNDGROWTH() function calculates a series of values that represent a compound growth of the first nonzero value in the specified member across the specified range of members.0525 2105 0."Rate". variable name. or expression which provides a constant value.Single member specification.FY1991:FY1996). "Growth"= @COMPOUNDGROWTH("Principal". rateMbrConst . 9-8 Hyperion . The input line must be a single deposit. rangeList]) principalMbr .0525 2215. Syntax @COMPOUNDGROWTH(principalMbr.51 0. Example The following example determines the compound growth of Principal Amount based on Growth Rate across a series of fiscal years.0525 2583.0525 2454.0525 2718.25 0.Member specification representing the initial value to be compounded. This example produces the following results: FY1991 FY1992 FY1993 FY1994 FY1995 FY1996 Principal Rate Growth 2000 0.0525 2331. rateMbrConst [. • • A null value returns the last member of the specified genLevNum. An integer value returns the member name relative to the current member being calculated: • Negative value for a prior member.genLevNum) provide a member range list. Hyperion 9-9 . Syntax @CURRMBRRANGE(dimName. genLevNum. {GEN|LEV}. The startOffset and endOffset parameters create a subset of this list. endOffset Defines the last member in the range to be returned. [endOffset]) GEN|LEV . genLevNum .Defines whether the range list to be returned is based on a generation or a level within the dimension. An integer value indicates the member relative to the current member being calculated: • Negative value for a prior member. • 0 for the member currently being calculated. [startOffset].Integer value that defines the absolute generation or level number of the range list to be returned.{GEN|LEV}. The first three parameters of this function (dimName.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @CURRMBRRANGE The @CURRMBRRANGE() function generates a member list that is based on the relative position of the current member being calculated. • positive value for a subsequent member. • 0 for the member currently being calculated. startOffset Defines the first member in the range to be returned: • • A null value indicates the first member of the specified genLevNum. • positive value for a subsequent member. Jun.9 Range and Financial Functions Hyperion Essbase Calc Scripts Example 1 The following examples use the Sample Basic database. Apr. Dec).0) Current Member Jan Feb Mar Apr Returns (Jan) (Jan.0. May. Jul. Oct. Mar. Nov.0. Sep. Mar) (Jan. Feb. the full range list contains the level 0 members of the Year dimension (Jan. Feb) (Jan. Feb. Mar.LEV.. Consider the following statement: @CURRMBRRANGE(Year. Apr) Consider the following statement: @CURRMBRRANGE(Year.-1. Mar. Feb. Aug. Mar) (Feb. Feb. Apr) 9-10 Hyperion .LEV.1) Current Member Jan Feb Mar Returns (Jan. In this example. Feb) (Jan. Nov 200 Dec 210 105 110 115 120 . 0. @MAXRANGE. . @COMPOUND. and dividing the result by the number of periods to date plus one period. 155 155 Since a null value is specified for startOffset. 1. . specifies that the member after the current member being calculated is included in each average operation. such as @AVGRANGE. Jan. Notes You cannot use the @CURRMBRRANGE function in a FIX statement. LEV. . Hyperion 9-11 . . the average operations always begin at the first member of the range list. and @SHIFT. The values for Nov and Dec are the same since there is no member after Dec in the range list.Hyperion Essbase Calc Scripts Range and Financial Functions 9 Example 2 Average Inventory is calculated by summing opening inventories from the first month of the year next month.@CURRMBRRANGE(Year. The endOffset parameter. 1)). this function can be used only within range and financial functions. . This example produces the following result: Jan Opening Inventory Average Inventory 100 Feb 110 Mar 120 Apr 130 . Currently. "Average Inventory" = @AVGRANGE(SKIPNONE."Opening Inventory". salvageMbrConst.Single member specification.Single member specification.9 Range and Financial Functions Hyperion Essbase Calc Scripts @DECLINE The @DECLINE() function calculates the amount per period that an asset in the current period may be depreciated for the specified period using the declining balance method. or numeric expression that provides a constant value.296 FY1994 0 0 0 778 9-12 Hyperion . "Decline Dep" = @DECLINE(Asset. This example produces the following results: FY1991 Asset Residual Life Decline Dep 9.FY1991:FY1994). to calculate a double declining balance. salvageMbrConst .600 FY1992 0 0 0 2. Example The following example calculates the depreciation of Asset for the specified series of fiscal years. variable name.Residual. rangeList]) costMbr . variable name. This value represents the number of periods over which the asset is depreciated. factorMbrConst [.Life. This value represents the factor by which the asset is depreciated. variable name. This value represents the value of the asset at the end of the depreciation.000 750 5 3.Single member specification. lifeMbrConst. Syntax @DECLINE (costMbr. lifeMbrConst . or numeric expression that provides a constant value.Single member specification representing the starting value of the asset(s). set factorMbrConst to 2. For example.2. factorMbrConst . or numeric expression that provides a constant value.160 FY1993 0 0 0 1. Declining Balance Depreciation Method . in which double the Declining Balance Depreciation Method amount is taken the first year. rather than to the original cost.Hyperion Essbase Calc Scripts Range and Financial Functions 9 Notes More than one asset can be input and depreciated across the specified range.A rapid depreciation method in which a percentage rate is applied to the undepreciated balance. Double-Declining Balance Depreciation Method . Hyperion 9-13 .Method of accelerated depreciation. The function calculates each asset separately. and then that same percentage is applied to the undepreciated amount in subsequent years. rateMbrConst [.Member specification representing the value(s) you want to discount from the last period in rangeList to the current period.05 952. variable name.9 Range and Financial Functions Hyperion Essbase Calc Scripts @DISCOUNT The @DISCOUNT() function calculates the discounted value at the beginning of the first period for amounts at end each period.00 0.05 783. 9-14 Hyperion . This example produces the following results: FY1991 Cash Credit Rate Discount 1000.FY1991:FY1995). "Discount" = @DISCOUNT(Cash.Member specification.38 FY1992 1000. or numeric expression which provides a constant value.05 907.03 FY1993 1000.00 0.05 822.00 0. Example The following example discounts the values in Cash by the rates in Credit Rate and places the results in Discount Amount for each fiscal year.53 Notes More than one value can be discounted simultaneously in this manner.00 0.00 0. rangeList]) cashMbr .05 863. Syntax @DISCOUNT (cashMbr. rateMbrConst . not a percent."Credit Rate". The value represents the rate per period which cashMbr is discounted. It is a decimal value.70 FY1995 1000.84 FY1994 1000. This example produces the following results: FY1991 Principal Amount Growth Rate Growth Amount 1.FY1991:FY1996).380 1. or numeric expression providing a constant value that represents the decimal growth rate to be applied (for example. 10% = . rateMbrConst .200 1.1 1.280 1.07 0. Example The following example calculates the growth of Principal. using the rate found in Growth Rate for each fiscal year.08 0."Growth Rate".000 FY1992 0 FY1993 2.480 Hyperion 9-15 . The first nonzero value encountered is the initial value. The results are placed in Growth Amount.1 0.Single member specification that represents the initial value of the value to grow.05 0.120 1.1). rateMbrConst [.Single member specification. rangeList]) principalMbr . variable name.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @GROWTH The @GROWTH() function calculates a series of values that represent a linear growth of an initial value across the specified range.000 FY1994 0 FY1995 0 FY1996 0 0.08 0. Syntax @GROWTH(principalMbr.050 1. Other principalMbr values after the first are ignored. "Amount"=@GROWTH("Principal". creditrateMbrConst. "Amount" = @INTEREST(Balance. If the value specified by balanceMbr is negative.065 0. The value must be a decimal number that corresponds to a percentage. rangeList]) balanceMbr . variable name.1125 130.065 FY1996 -6000 0. creditrateMbrConst .Single member specification.065 FY1993 -1000 0. borrowrateMbrConst . The interest is calculated for each time period in the specified range.FY1991:FY1996).1125 0.50 195.00 0. or numeric expression providing a constant value.065 FY1995 9000. the interest rate applied is the value specified by balanceMbr. If the value specified by balanceMbr is positive. Example This example calculates the interest for Balance. Syntax @INTEREST(balanceMbr.9 Range and Financial Functions Hyperion Essbase Calc Scripts @INTEREST The @INTEREST() function calculates the simple interest of a value at the specified rate."Credit Rate".Single member specification representing the balance at the time the interest is calculated.00 9-16 Hyperion .1125 0.1125 0.1125 0.00 -112. using Credit Rate for positive balances and using Borrow Rate for negative balances. The results are placed in Amount for each fiscal year. The value must be a decimal number corresponding to a percentage value. borrowrateMbrConst [.00 585. FY1991 Balance Credit Rate Borrow Rate Amount 2000 0.00 195.065 FY1992 3000 0. or numeric expression providing a constant value. the interest rate applied is the value specified by creditrateMbrConst.Single member specification.1125 0."Borrow Rate". variable name.00 -675.065 FY1994 3000 0. Hyperion Essbase Calc Scripts Range and Financial Functions 9 @IRR The @IRR() function calculates the Internal Rate of Return on a cash flow that must contain at least one investment (negative) and one income (positive) value. Syntax @IRR(cashflowMbr, discountFlag[, rangeList]) cashflowMbr Single member specification. discountFlag Member specification, variable name, or numeric expression providing a constant value of either 1 or 0. discountFlag indicates whether the function should discount from the first period. 1 means do not discount from the first period. Example Example This example calculates the Internal Rate of Return (Return) on a cash flow (Cash). Return = @IRR(Cash,0,FY1991:FY1996); This example produces the following results: FY1991 Cash Return (1,000) 0.41 FY1992 500 0.41 FY1993 500 0.41 FY1994 500 0.41 FY1995 500 0.41 FY1996 500 0.41 Notes Essbase returns #MISSING from calculator function @IRR if all cash flows are zero. Hyperion 9-17 9 Range and Financial Functions Hyperion Essbase Calc Scripts @IRR provides an initial guess of 0.07. This cannot be changed, in contrast to similar functions in Excel. Because results depend in part on the initial guess, any difference in the initial guess may result in a different result. Even if both Excel and Essbase start with the same initial guess, results may differ. This is because there may be more than one solution to an equation, and the algorithm stops looking when it finds a valid solution. Which solution is found first may differ based on the algorithm. Although leading or trailing zeros do not matter in a mathematical context, the algorithm may behave differently and find a different root because of the presence of leading or trailing zeros. If you need identical solutions regardless of the presence of leading or trailing zeros, you may wish to create a custom-defined function to handle these issues. 9-18 Hyperion Hyperion Essbase Calc Scripts Range and Financial Functions 9 @MAXRANGE The @MAXRANGE() function returns the maximum value of the specified member across the specified range of members. Syntax @MAXRANGE (mbrName [ ,rangeList]) Example In the Sample Basic database: Qtr1 = @MAXRANGE(Sales,@CHILDREN(Qtr1)); This example produces the following results: Jan Sales 678 Feb 645 Mar 675 Qtr1 678 Notes Depending on the values in the list, @MAXRANGE may return a zero(0) or #MISSING value. For full control over skipping or inclusion of zero(0) and #MISSING values, it is recommended to use the @MAXSRANGE function instead of the @MAXRANGE function. Hyperion 9-19 9 Range and Financial Functions Hyperion Essbase Calc Scripts @MAXSRANGE The @MAXSRANGE() function returns the maximum value of the specified member across the specified range of members. @MAXSRANGE enables skipping of #MISSING and 0 values, in contrast with the @MAXRANGE function, which cannot ignore these values. Syntax @MAXSRANGE (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH, mbrName [ ,rangeList]) Examples For both examples, assume a database similar to Sample Basic. Example 1 COGS( Qtr1_Max = @MAXSRANGE(SKIPBOTH, COGS, Jan:Mar);) Other_Exp( Qtr1_Min = @MAXSRANGE(SKIPBOTH, Other_Exp, Jan:Mar);) This example ignores #MISSING and 0 values and produces the following results: Jan Other_Exp COGS -500 0 Feb #MISSING 1500 Mar -250 2300 Qtr1_Max --500 1500 Example 2 Qtr1_Max = @MAXSRANGE (SKIPNONE, OtherInc_Exp, @CHILDREN(Qtr1)); produces the following results: Jan Other_Exp COGS -500 0 Feb #MISSING 1500 Mar -250 2300 Qtr1_Max 0 0 9-20 Hyperion Hyperion Essbase Calc Scripts Range and Financial Functions 9 Notes @MAXSRANGE (SKIPNONE, mbrName, rangeList) is equivalent to @MAXRANGE mbrName, (rangeList). #MISSING values are considered to be greater than negative data values and less than positive data values. If the data being calculated includes only negative and #MISSING values, @MAXSRANGE returns #MISSING. For all members, @MAXSRANGE returns the value calculated for the specified member and range list. Hyperion 9-21 9 Range and Financial Functions Hyperion Essbase Calc Scripts @MDSHIFT The @MDSHIFT() function shifts a series of data values across multiple dimension ranges. Syntax @MDSHIFT (mbrName, shiftCnt1, dimName1, [range1], . . . shiftCntX, dimNameX, [rangeX]) shiftCnt1...shiftCntX - Integer that defines the number of member positions to shift. range1 . . . rangeX - A valid member name, a comma-delimited list of member names, member set functions, and range functions from the same dimension. If the range list is comma delimited, then the list must be enclosed in parentheses. Example The Budget figures for Ending Inventory need to be calculated by taking Prior Year->Opening Inventory results as a starting point: FIX (Budget) "Ending Inventory" = @MDSHIFT("Opening Inventory", 1, Year, , -1, Scenario,); ENDFIX In this example, range1 is not specified, so Essbase defaults to the level 0 members of the Year dimension, which was specified as the dimName1 parameter. Since range2 is also not specified, Essbase defaults to the level 0 members of the Scenario dimension, which was specified as the dimName2 parameter. This example produces the following (partial) results: Jan Prior Year Opening Inventory Ending Inventory 110 Feb 120 Mar 130 Budget 120 130 140 9-22 Hyperion Hyperion Essbase Calc Scripts Range and Financial Functions 9 @MINRANGE The @MINRANGE() function returns the minimum value of the specified member across the specified range of members. Syntax @MINRANGE (mbrName [ ,rangeList]) Example In the Sample Basic database: Qtr1 = @MINRANGE(Sales,Jan:Mar); This example produces the following results: Jan Sales 678 Feb 645 Mar 675 Qtr1 645 Notes Depending on the values in the list, @MINRANGE may return a zero(0) or #MISSING value. For full control over skipping or inclusion of zero(0) and #MISSING values, it is recommended to use the @MINSRANGE function instead of the @MINRANGE function. Hyperion 9-23 9 Range and Financial Functions Hyperion Essbase Calc Scripts @MINSRANGE The @MINSRANGE() function returns the minimum value of mbrName across rangeList. @MINSRANGE enables skipping of #MISSING and 0 values, in contrast with the @MINRANGE function, which always includes these values in the calculation. Syntax @MINSRANGE (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH, mbrName [,rangeList]) Examples For both examples, assume a database similar to Sample Basic. Example 1 COGS( Qtr1_Min = @MINSRANGE(SKIPBOTH, COGS, Jan:Mar);) Other_Exp( Qtr1_Min = @MINSRANGE(SKIPBOTH, Other_Exp, Jan:Mar);) This example ignores the 0 value for Mar and produces the following results: Jan COGS Other_Exp #MISSING 500 Feb 1500 350 Mar 2300 0 Qtr1_Min 1500 350 Example 2 COGS( Qtr1_Min = @MINSRANGE(SKIPNONE, COGS, Jan:Mar);) Other_Exp( Qtr1_Min = @MINSRANGE(SKIPNONE, Other_Exp, Jan:Mar);) This example does not ignore the 0 value in the calculation. This example produces the following results: Jan COGS Other_Exp #MISSING 500 Feb 1500 350 Mar 2300 0 Qtr1_Min #Missing 0 9-24 Hyperion rangeList) is equivalent to @MINRANGE (mbrName. Iif the data being calculated includes only positive and #MISSING values. @MINSRANGE returns #MISSING. #MISSING values are considered to be less than positive data values and more than negative data values. rangeList).Hyperion Essbase Calc Scripts Range and Financial Functions 9 Notes @MINSRANGE (SKIPNONE. Hyperion 9-25 . mbrName. Syntax @NEXT (mbrName [..Feb.. retaining all other members identical to the current member. rangeList]) n . Since rangeList is not specified. the default is 1. Since n is not specified. This example produces the following results: Jan Cash Next Cash Two Cash Feb 100 90 120 Mar 90 120 110 Apr 120 110 150 May 110 150 100 Jun 150 100 #MI 100 #MI #MI Notes If you do not specify n. Using a negative value for n has the same effect as using the matching positive value in the @PRIOR function. “Two Cash” = @NEXT(Cash . n. Example In this example. then the default is set to 1. . the level 0 members from the dimension tagged as Time are used (Jan.signed integer.Mar.). which provides the next member in the range.9 Range and Financial Functions Hyperion Essbase Calc Scripts @NEXT The @NEXT() function returns the nth cell value in the sequence rangeList from mbrName. 9-26 Hyperion . "Next Cash" = @NEXT(Cash). which provides the next member in the range.2). Next Cash for each month is derived by taking the Cash value for the following month. @NEXT cannot operate outside the given range. @NEXTS works within a designated range and retains all other members identical to the current member. Next Cash for each month is derived by taking the Cash value for the following month and ignoring both #MISSING and zero values.. which returns the next prior member from the lowest level of the dimension set as Time in the database outline. or both #MISSING and zero values. the default is 1. because rangeList is not specified. 2). then a default value of 1 is assumed.n.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @NEXTS The @NEXTS() function returns the nth cell value in the sequence rangeList from the mbrName. @NEXTS provides the option to skip #MISSING. Also.Feb.rangeList]) n . the level 0 members from the dimension set as Time are used (Jan.). Cash. Because n is not specified.. Cash). Jan Cash Next Cash Two Cash 1100 1000 1000 Feb #MI 1000 1300 Mar 1000 1300 1400 Apr 1300 1400 #MI May 0 1400 #MI Jun 1400 #MI #MI Notes Using a negative value for n has the same effect as using the matching positive value in @PRIORS.signed integer.Mar. zero. Example In this example. Syntax @NEXTS(SKIPNONE | SKIPMISSING | SKIPZERO | | SKIPBOTH mbrName[. Hyperion 9-27 .. which provides the next member in the range. "Next Cash" = @NEXTS(SKIPBOTH. "Two Cash" = @NEXTS(SKIPBOTH. If you do not specify n. 000) . rateMbrConst.62 1547. Value is calculated with the following formula: Value = @NPV(Cash. Example In this example. variable name. discountFlag [. 0. 1 means do not discount from the first period. discountFlag . variable name.Member specification providing a series of numeric values.62 1547. rangeList]) cashflowMbr .62 1547. providing a constant value. rateMbrConst . This example produces the following report: FY1991 Cash Rate Value (1. or numeric expression set to 0 or 1 to indicate whether the function should discount from the first period.62 FY1992 500 FY1993 500 FY1994 500 FY1995 500 FY1996 500 9-28 Hyperion . Rate. Syntax @NPV (cashflowMbr.62 1547. FY1991:FY1996).05 1547.Single member specification.62 1547.9 Range and Financial Functions Hyperion Essbase Calc Scripts @NPV The @NPV() function calculates the Net Present Value of an investment based on the series of payments (negative values) and income (positive values). or numeric expression.Single member specification. Prev = @PRIOR(Value). Prev2 = @PRIOR(Value. n. which returns the next prior member from the lowest level of the dimension tagged as Time in the database outline. rangeList]) n . Syntax @PRIOR (mbrName [.signed integer. Hyperion 9-29 . This example produces the following results: Jan Value Prev Prev2 1100 #MI #MI Feb 1200 1100 #MI Mar 1300 1200 1100 Apr 1400 1300 1200 May 1500 1400 1300 Jun 1600 1500 1400 Notes Using a negative value for n has the same effect as using the matching positive value in the @NEXT function. If you do not specify n. Example In this example. Prev Inventory for each month is derived by taking the Inventory value from the previous month. then a default value of 1 is assumed. 2).Hyperion Essbase Calc Scripts Range and Financial Functions 9 @PRIOR The @PRIOR() function returns the nth previous cell member from mbrName in rangeList. "Prev2" = @PRIORS(SKIPBOTH. rangeList]) n . 9-30 Hyperion . @PRIORS provides options to skip #MISSING. Because n is not specified. Prev Inventory for each month is derived by taking the Inventory value from the previous month and ignoring #MISSING and zero values. the default is 1. Also. which returns the next prior member from the lowest level of the dimension set as Time in the database outline. Syntax @PRIORS(SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH mbrName[. zero.n.9 Range and Financial Functions Hyperion Essbase Calc Scripts @PRIORS The @PRIORS() function returns the nth previous cell member from mbrName in the rangeList. "Prev" = @PRIORS(SKIPBOTH. If you do not specify n. the level 0 members from the dimension are set as Time used as (Jan. because rangeList is not specified. then a default value of 1 is assumed..signed integer. @PRIORS works within the designated range.Mar. Example In this example. or both #MISSING and zero values.Value).2)..Feb. This example produces the following results: Jan Value Prev Prev2 1100 #MI #MI Feb #MI 1100 #MI Mar 1300 1100 #MI Apr 1400 1300 1100 May 0 1400 1300 Jun 1600 1400 1300 Notes Using a negative value for n has the same effect as using the matching positive value in the @NEXTS function.Value. All other dimensions assume the same members as the current member.).. which provides the next prior member in the range. Last. QTD = @PTD(Apr:May). Example In this example. data is summed unless Accounts are tagged as "First" or "Last". Ending Inventory is tagged time balance . assume that the Year dimension in the Sample Basic database outline contains two additional members. YTD = @PTD(Jan:May). YTD and QTD. By default.Range of members from the dimension tagged as Time. Syntax @PTD (timePeriodList) timePeriodList . respectively. This example produces the following results: Sales Jan Feb Mar Qtr1 Apr May Jun Qtr2 QTD YTD 1000 1000 1000 3000 1000 1000 1000 3000 2000 5000 Opening Inventory 1000 1100 1200 3000 1300 1400 1500 3000 1300 1000 Ending Inventory 1100 1200 1300 3000 1400 1500 1600 3000 1500 1500 Hyperion 9-31 . which returns the period’s first and last value.First.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @PTD The @PTD() function calculates the period-to-date values of members in the dimension tagged as Time. Opening Inventory is tagged time balance . Example In this example. Since rangeList is not specified for either formula.signed integer. "Prev" = @SHIFT(Value. when the usage is likely to be NEXT and/or PRIOR).9 Range and Financial Functions Hyperion Essbase Calc Scripts @SHIFT The @SHIFT() function returns the nth cell value in the sequence rangeList from mbrName. The direction of shift is wholly based on n. Syntax @SHIFT (mbrName [. @SHIFT is provided as a more appropriate. Prev Asset for each month is derived by taking the Asset value from the previous month because -1 is specified as the n parameter. with positive n values producing an effect equivalent to @NEXT and negative values of n producing an equivalent effect to @PRIOR. the level 0 members from the dimension tagged as Time are used. self-documenting name than @NEXT or @PRIOR when the value for n is a variable and may change from positive to negative. Next Avl Asset for each month is derived by taking the Asset value from two months following the current month because 2 is specified as the n parameter.1). "Next" = @SHIFT(Value. This example produces the following results: Jan Value Prev Next 1100 #MI 1200 Feb 1200 1100 1300 Mar 1300 1200 1400 Apr 1400 1300 1500 May 1500 1400 1600 Jun 1600 1500 #MI Notes This function gets either the prior or next (nth past or future value in rangeList) value of mbrName. based on n. depending on the database state when the call occurs (that is.n. rangeList]) n . retaining all other members identical to the current member.-1). 9-32 Hyperion . FY1991:FY1996). the depreciation for each year is calculated by taking into account the initial asset (Asset). lifeMbrConst [.Single member specification. "SLN Dep" = @SLN(Asset. or numeric expression representing the useful life of the asset. Syntax @SLN(costMbr. Example In this example. variable name. or numeric expression. salvageMbrConst.Single member specification.Life. This example produces the following results: FY1991 Asset Residual Life SLN Dep 9000 750 5 1650 1650 1650 1650 1650 #MI FY1992 FY1993 FY1994 FY1995 FY1996 Notes More than one asset may be depreciated over the range. rangeList]) costMbr . the salvage value of the asset (Residual). calculated across a range of periods. lifeMbrConst . and the life of the asset (Life). This value represents the value of the asset in the current period at the end of the useful life of the asset. salvageMbrConst . variable name.Single member specification representing an input asset for the current period.Residual. Hyperion 9-33 . It uses a straight-line depreciation method. providing a constant numeric value.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @SLN The @SLN() function calculates the amount per period that an asset in the current period may be depreciated. Straight line depreciation calculates the depreciation of an asset assuming it will depreciate an equal amount of value each year. 9 Range and Financial Functions Hyperion Essbase Calc Scripts @SUMRANGE The @SUMRANGE() function returns the summation of all the values of the specified member across the specified range. Syntax @SUMRANGE(mbrName [. rangeList]) Example The following example is based on the Sample Basic database. "Partial Year"=@SUMRANGE("New York". Partial Year. Assume that the Year dimension contains an additional member. This example produces the following (partial) results: Sales Jan Feb Mar Qtr1 Apr May Jun Qtr2 Partial Year 400 100 100 100 300 100 100 100 300 9-34 Hyperion .Feb:May). the salvage value of the asset (Residual). across a range of periods. salvageMbrConst . variable name.Single member specification. or numeric expression. rangeList]) costMbr . salvageMbrConst. SYD Dep"=@SYD(Asset. This example produces the following results: FY1991 Asset Residual Life SYD Dep 9000 750 5 2750 2200 1650 1100 550 #MI FY1992 FY1993 FY1994 FY1995 FY1996 Notes More than one asset may be depreciated over the range. the depreciation for each year is calculated by taking into account the initial asset (Asset). The depreciation method used is sum of the years’ digits. variable name.Hyperion Essbase Calc Scripts Range and Financial Functions 9 @SYD The @SYD() function calculates the amount per period that an asset in the current period may be depreciated. and the life of the asset (Life). Example In this example.Residual. Sum of years’ digits calculates depreciation of an asset by assuming higher depreciation charges in the early years of an asset's life. lifeMbrConst .Life. This value is the value of the asset in the current period after the useful life of the asset. lifeMbrConst [. Syntax @SYD (costMbr. or numeric expression representing the useful life of the asset.FY1991:FY1996).Single member specification representing an input asset for the current period. providing a constant numeric value. Hyperion 9-35 .Single member specification. Retrieve into this sheet. Are the values in the yellow cells as expected? If not. Additions are the difference between ending and opening inventory for the month. Perform a retrieval and notice the calculation results within the yellow cells. Additions are the difference between ending and opening inventory for the month. Save the new script as CSPrior.xls 1) 2) From Essbase Application Manager. The values in yellow have not been calculated. Create a calc script to calculate opening inventory and inventory additions. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSPrior SS_Prior. The opening inventory value is the ending inventory for the previous month. January opening inventory is difference between January’s ending inventory and additions. run the CSPrior calc script. Open the SS_Prior spreadsheet.9 Range and Financial Functions Hyperion Essbase Calc Scripts Exercise 9-1: Applying Range Functions (@PRIOR) In this exercise. From the Calc&Retrieve sheet. you create a calc script that calculates opening inventory and inventory additions. The opening inventory value is the ending inventory for the previous month. Switch to the Calc&Retrieve sheet. Close the spreadsheet. Lock and send the data in the Lock&Send sheet to the HLandS2 database. January opening inventory is difference between January’s ending inventory and additions. revise the CSPrior calc script and rerun the calculation until the yellow cells contain the expected results. For this exercise. clear all data from the HLandS2 database. 3) 4) 5) 6) 7) 8) 9-36 Hyperion . xls 1) From Essbase Application Manager. modify the CSIrr calc script and rerun the calculation until you get the expected results. From the Calc&Retrieve sheet.000 to purchase the capability to produce the "4000 Product Family". run the CSIrr calc script. Hook Line and Sinker invested $38. The ROI is calculated using the product line profits for the subsequent years. In 1997.Hyperion Essbase Calc Scripts Range and Financial Functions 9 Exercise 9-2: Applying Financial Functions (@IRR) In this exercise. Open the SS_Irr spreadsheet. Close the spreadsheet. you create a calc script that calculates the internal rate of return on an investment. 2) 3) 4) 5) 6) 7) 8) Hyperion 9-37 . If they are not the same. Switch to the Calc&Retrieve sheet. In 1997. The ROI is calculated using this product family’s profits for the subsequent years. clear all data from the HLandS2 database. Save the new script as CSIrr.000 to purchase the capability to produce the "4000 Product Family". Create a calc script to calculate the internal rate of return on an investment. Perform a retrieval and notice the ROI calculation results. Compare the ROI results with the values in the “Expected Res” sheet. Retrieve into this sheet. Database Calc Script (new) Spreadsheet CALC:HLandS2 CSIrr SS_Irr. Hook Line and Sinker invested $38. Lock and send the data in the Lock&Send sheet to the HLandS2 database. The values in yellow have not been calculated. Rather than return a single value.9 Range and Financial Functions Hyperion Essbase Calc Scripts Unit Summary Range and Financial functions perform mathematical operations on a range of values. these functions calculate a series of values internally based on the range specified. Financial functions execute specialized financial calculations. 9-38 Hyperion . Hyperion Essbase Calc Scripts Range and Financial Functions 9 þ Check Your Understanding Now that you have completed the chapter. identify the Range (Financial) function that you would use to retrieve the required value. Use the Sample Basic outline.) What the value of sales for the month in which sales is largest? What is the value of sales three months after the month currently being processed? What is the average amount of monthly sales? What is the amount of compound interest for a series of debt payments? What is the internal rate of return on an investment? Hyperion 9-39 . (Multiple solutions may be correct for some of these answers. check your understanding by responding to the following questions: 1) For each of the following situations. 9 Range and Financial Functions þ Check Your Understanding Solutions 1) Hyperion Essbase Calc Scripts For each of the following situations. Use the Sample Basic outline.) @MAXRANGE What the value of sales for the month in which sales is largest? What is the value of sales three months after the month currently being processed? What is the average amount of monthly sales? What is the amount of compound interest for a series of debt payments? What is the internal rate of return on an investment? @NEXT @AVGRANGE @COMPOUND @IRR 9-40 Hyperion . identify the Range (Financial) function that you would use to retrieve the required value. (Multiple solutions may be correct for some of these answers. you will be able to: • • Explain the purpose and use of Allocation functions to generate member lists Practice using the Allocation functions in a series of incremental exercises .10 Allocation Functions Chapter Objectives By the end of this chapter. allocationRange should be from only one level (for example. the member must be from the dimension to which allocationRange belongs. If amount is a member. member. allocationRange A comma-delimited list of members. The value may also be a constant.10 Allocation Functions Hyperion Essbase Calc Scripts Using Allocation Functions Allocation functions allocate values that are input at the parent level. The member (or at least one member of a cross-dimensional member) must be included in allocationRange. based on specified criteria. or range functions from the same dimension. member set functions. The parameters that are common to both allocation functions are described here. If amount is a cross-dimensional member. @CHILDREN(Total Expenses) rather than from multiple levels (for example. at least one of its members must be from the dimension to which allocationRange belongs. basisMbr A value. roundMbr The member or cross-dimensional member to which rounding errors are added. or cross-dimensional member that contains the value to be allocated into allocationRange. amount A value. The values are allocated across child members in one or more dimensions. into which value(s) from amount are allocated. The method you specify determines how the basis data is used. Common Parameters The allocation functions share a common set of parameters. 10-2 Hyperion . These functions consolidate the common tasks that are required to perform allocations in Essbase. or cross-dimensional member that contains the values that provide the basis for the allocation. member. the @MDALLOCATE function has an extra set of parameters to identify the dimensions that are used to distribute the amount. In addition. @DESCENDANTS(Product)). and stores #MISSING for values in allocationRange for which the basisMbr is zero (0) or #MISSING.Hyperion Essbase Calc Scripts method Allocation Functions 10 The expression that determines how values are allocated. SKIPBOTH: Excludes all zero (0) values and all #MISSING values. and stores #MISSING for values in allocationRange for which the basisMbr is zero. SKIPNONE: Includes all cells. and stores #MISSING for values in allocationRange for which the basisMbr is missing. SKIPZERO: Excludes all zero (0) values in basisMbr. You must specify a SKIP parameter only for spread. allocationRange)) SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH: Values to be ignored during calculation of the spread. One of the following: Uses basisMbr to calculate a percentage share. percent Takes a percentage value from basisMbr for each member in allocationRange and applies the percentage value to amount: amount * (@CURRMBR()->basisMbr * .01) add Takes the value from basisMbr for each member of allocationRange and adds the value to amount: amount + @CURRMBR()->basisMbr subtract Takes the value from basisMbr for each member of allocationRange and subtracts the value from amount: amount . SKIPMISSING: Excludes all #MISSING values in basisMbr.@CURRMBR()->basisMbr multiply Takes the value from basisMbr for each member of allocationRange and multiplies the value by amount: amount * @CURRMBR()->basisMbr divide Takes the value from basisMbr for each member of allocationRange and divides the value by amount: amount/@CURRMBR()->basisMbr Hyperion 10-3 . The percentage share is calculated by dividing the value in basisMbr for the current member in allocationRange by the sum across the allocationRange for that basis member: amount * (@CURRMBR()->basisMbr/ @SUM(allocationRange-> basisMbr) share spread Spreads amount across allocationRange: amount * (1/@COUNT(SKIP. If you specify roundAmt. [numDigits [. #MISSING is treated as the lowest value in a list. you also may specify numDigits to indicate the number of decimal places to which to round. If allocated values are identical. You may also specify roundError. If you do not specify roundErr. adds rounding errors to the first value in allocationRange. the allocated values are rounded to the specified number of decimal places. An expression that specifies where rounding errors should be placed.10 Allocation Functions round noRound roundAmt. the allocated values are rounded to the nearest integer. roundErr may be one of the following: errorsToHigh Adds rounding errors to the member with the highest allocated value. The default value for numDigits is 0. adds rounding errors to the first value in allocationRange. roundErr. You must specify numDigits if you specify roundAmt. if multiple values are #MISSING. If allocated values are identical. Adds rounding errors to the specified roundMbr. which is an expression that specifies where rounding errors should be placed. rounding errors are added to the first #MISSING value in the list. the allocated values are rounded to a power of 10. If numDigits is 0. If numDigits is greater than 0. errorsToLow errorsToMbr 10-4 Hyperion . roundErr]] Hyperion Essbase Calc Scripts One of the following: No rounding. Essbase discards rounding errors. noRound is the default Indicates that you want to round the allocated values. which must be included in allocationRange. Adds rounding errors to the member with the lowest allocated value. numDigits An integer that represents the number of decimal places to round to. If numDigits is a negative value. Each function is also described. @MDALLOCATE Hyperion 10-5 .Hyperion Essbase Calc Scripts Allocation Functions 10 Summary of Allocation Functions This table summarizes the Allocation Functions. in detail. Allocates values that are input at an upper level to lower-level members in multiple dimensions. in this chapter. Function @ALLOCATE Used to generate a list containing Allocates values that are input at an upper level to lower-level members. The allocation for each of child of Total Expenses is based on the child's share of actual expenses for the prior year (PY Actual): FIX("Total Expenses") Budget = @ALLOCATE(Budget->"Total Expenses". basisMbr. numDigits][. Essbase displays a warning message. “PY Actual”. for the prior year's actual expenses. Data values of 7000 is loaded into Budget->Total Expenses for Jan. The Essbase outline contains a Scenario dimension with two members. The allocation is based upon a specified share or spread of another variable.method [."PY Actual". [roundMbr]. You need to allocate values to each expense category (to each child of Total Expenses). round [.. methodParams] [.10 Allocation Functions Hyperion Essbase Calc Scripts @ALLOCATE The @ALLOCATE() function allocates values that are input at an upper level to lower-level members. For example. Syntax @ALLOCATE (amount. 10-6 Hyperion . ENDFIX This example produces the following (partial) results: PY Actual Marketing Payroll Misc Total Expenses 5000 4000 1000 10000 Budget 3500 2800 700 7000 Notes If no member or cross-dimensional member is from the dimension to which allocationRange belongs. you can allocate values loaded to a parent member to all of that member's children. @CHILDREN("Total Expenses"). and “Budget” for budget expenses.share). You can specify a rounding parameter for allocated values and account for rounding errors. allocationRange. roundErr]]) Example Consider the following example. . rather. it cannot be a Dynamic Calc member. your formula should look like this: Member Name = @ALLOCATE (. When you use @ALLOCATE in a calculation script. they calculate a series of values internally based on the range specified. Hyperion 10-7 .) This is because allocation functions never return a value. using it may improve calculation performance. Although FIX is not required. FIX on the member to which the allocation amount is loaded.. If you use @ALLOCATE in a member formula.Hyperion Essbase Calc Scripts Allocation Functions 10 If the amount parameter is a loaded value. use it within a FIX statement. for example. . ENDFIX 10-8 Hyperion . method [. You can specify a rounding parameter for allocated values and account for rounding errors. or range functions from the multiple dimensions into which values from amount are allocated. share).. member set functions. allocationRange1.@CHILDREN("Total Expenses"). The allocation is based upon a specified share or spread of another variable. allocationRangeN Comma-delimited lists of members. @CHILDREN(East).. numDigits][.. You need to allocate this total budgeted amount across each expense category for each child of East. The allocation for each child of East is based on the child's share of Total Expenses->Actual: FIX("Total Expenses") Budget = @MDALLOCATE(Budget->"Total Expenses"->East. Example Consider the following example from the Sample Basic database. Actual. round [. methodParams] [.10 Allocation Functions Hyperion Essbase Calc Scripts @MDALLOCATE The @MDALLOCATE function allocates values that are input at an upper level to lower-level members in multiple dimensions. roundErr]]) Additional Parameters The additional parameters for the @MDALLOCATE function are: Ndim The number of dimensions across which values are allocated. Syntax @MDALLOCATE (amount. allocationRange1.. Ndim. A data value of 2200 is loaded to Budget->Total Expenses->East for Jan and Colas. basisMbr. allocationRangeN.2. [roundMbr]. When you use @MDALLOCATE in a calculation script. Colas: Marketing Payroll Misc Total Expenses 400 400 400 400 400 Actual New York Massachusetts Florida Connecticut New Hampshire East 100 100 100 100 100 200 200 200 200 200 100 100 100 100 100 500 110 110 110 110 110 1000 220 220 220 220 220 500 110 110 110 110 110 2000 #MI #MI #MI #MI #MI Budget New York Massachusetts Florida Connecticut New Hampshire East #MI #MI #MI 2200 Notes If no member or cross-dimensional member is from the dimension to which allocationRange belongs. for example. Hyperion 10-9 . If you have very large allocationRange lists. FIX on the member to which the allocation amount is loaded. use it within a FIX statement. If the amount parameter is a loaded value.Hyperion Essbase Calc Scripts Allocation Functions 10 This example produces the following results for Jan. Essbase may return error messages during the calculation. If you receive error messages. Although FIX is not required. it cannot be a Dynamic Calc member. you may need to raise the number for CALCLOCKBLOCK DEFAULT or use CALCLOCKBLOCK HIGH in your calculation script. Essbase displays a warning message. using it may decrease calculation time. Switch to the Calc&Retrieve sheet. Do the Essbase results match those in the “Expected Results” column? If not. 3) 4) 5) 6) 7) 8) 10-10 Hyperion . Lock and send the data in the Lock&Send sheet to the HLandS2 database. Create a calc script to calculate the budgeted total expenses for Western market for January 2000. The budgeted total expenses are 5% greater than the actual total expenses for January 1999 and are distributed to the individual expense accounts in the same ratios as the actual January 1999 expenses. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSAlloc SS_Alloc. clear all data from the HLandS2 database. For this exercise. Close the spreadsheet. you create a calc script that calculates the budgeted total expenses for Western market for January 2000. From the Calc&Retrieve sheet. The “1999 Actual”-“West” and “2000 Budget” values have not been calculated.10 Allocation Functions Hyperion Essbase Calc Scripts Exercise 10-1: Applying Allocation Functions In this exercise. The budgeted total expenses are 5% greater than the actual total expenses for January 1999 and are distributed to the individual expense accounts in the same ratios as the actual January 1999 expenses. Retrieve into this sheet. Perform a retrieval and compare the “Total Expenses” results to those in the “Expected Results” column. Save the new script as CSAlloc. Open the SS_Alloc spreadsheet.xls 1) 2) From Essbase Application Manager. run the CSAlloc calc script. modify the CSAlloc calc script and rerun the calculation until you get the expected results. based on specified criteria. Adds the amount to the basisMbr for each member of allocationRange. The values are allocated across child members in one or more dimensions. spread percent add subtract multiply divide Hyperion 10-11 .Hyperion Essbase Calc Scripts Allocation Functions 10 Unit Summary Allocation functions allocate values that are input at the parent level. Multiplies the amount to the basisMbr for each member of allocationRange. Subtracts the amount from the basisMbr for each member of allocationRange. share Divides the amount among members of the allocation range using basisMbr to calculate a percentage share. Divides the amount evenly across all members of allocationRange. Treats the amount as a percentage value which is applied to basisMbr corresponding to the allocationRange member. There are several allocation methods that may be used. Divides the amount by the basisMbr for each member of allocationRange. 10-12 Hyperion . b. c. e. Each individual product’s budgeted advertising expense will be decreased by $500 over this year’s actual. The total budget expense is known for all products and is to be evenly distributed to individual products (each individual product is to receive the same amount of budget). Which allocation method would be most appropriate in each of the following situations? a. The total budget expense is known for all products and is to be allocated to individual products in the same proportion this year’s actual advertising expense for each product.10 Allocation Functions þ Check Your Understanding 1) Hyperion Essbase Calc Scripts Now that you have completed the chapter. d. Next year’s budget adveristing expense for each individual product is a 10% increase over this year ’s actual advertising expense. Each individual product’s budgeted advertising expense will be increased by $500 over this year’s actual. check your understanding by responding to the following questions: The value for advertising expense for next year budget is to be allocated to individual products. c. • add Each individual product’s budgeted advertising expense will be decreased by $500 over this year’s actual. The total budget expense is known for all products and is to be allocated to individual products in the same proportion this year’s actual advertising expense for each product. Which allocation method would be most appropriate in each of the following situations? a. • percent (or share) Each individual product’s budgeted advertising expense will be increased by $500 over this year’s actual. • spread Next year’s budget adveristing expense for each individual product is a 10% increase over this year ’s actual advertising expense. e. d. • share The total budget expense is known for all products and is to be evenly distributed to individual products (each individual product is to receive the same amount of budget). Hyperion 10-13 . • subtract b.Hyperion Essbase Calc Scripts Allocation Functions 10 þ Check Your Understanding Solutions 1) The value for advertising expense for next year budget is to be allocated to individual products. 10 Allocation Functions Hyperion Essbase Calc Scripts 10-14 Hyperion . 11 Forecasting Functions Chapter Objectives By the end of this chapter. you will be able to: • • Explain the purpose and use of Forecasting functions to generate member lists Practice using the Forecasting functions in a series of incremental exercises . or calculating future values. Forecasting Function Parameters There are common parameters associated with the various Forecasting functions mbrName Any valid single member name or member combination. analysis. A valid member name. Essbase uses the level 0 members from the dimension tagged as Time. Forecasting functions are often used in planning. interpolating. a comma-delimited list of member names. and range functions from the same dimension. or a function that returns a single member or member combination. If rangeList is not specified. rangelist 11-2 Hyperion . member set functions. and modeling applications.11 Forecasting Functions Hyperion Essbase Calc Scripts Using Forecasting Functions Forecasting functions manipulate data for the purpose of smoothing. Function @MOVAVG @MOVMAX @MOVMED @MOVMIN @MOVSUM * @MOVSUMX * Calculates A moving n-term average of an input data set. A moving n-term sum of an input data set. @SPLINE @TREND * New in Essbase XTD Release 6. A moving n-term maximum of an input data set.Hyperion Essbase Calc Scripts Forecasting Functions 11 Summary of Forecasting Functions This table summarizes the Forecasting Functions. A moving n-term sum of an input data set and provides several options that control how values are assigned to members that precede the n-term parameter. A moving n-term minimum of an input data set.1. in this chapter. A moving n-term median of an input data set. A smoothing spline to a set of data points. Hyperion 11-3 . Future values based on curve-fitting to historical values. Each function is also described. in detail.5. n [. The default is 3. Assume that the Measures dimension contains an additional member. In this example. The value for Mar represents the trailing average of Jan.Jan:Jun).3. The remaining values represent the trailing average for each group of three values.Feb) for Mov Avg and the first two values for Sales are the same. Mar. and the first terms (the n-1 terms) are copies of the input data. rangeList]]) n . and Mar. This example produces the following results: Sales Jan Feb Mar Apr May Jun 100 110 120 130 140 150 Mov Avg 100 110 110 120 130 140 In this example. Essbase averages three values at a time for the moving average. Each term in the set is replaced by a trailing mean of n terms. 11-4 Hyperion .A positive integer value that represents the number of values to average. The first two values (Jan. Feb. Mov Avg. The value for Apr represents the trailing average of Feb. Syntax @MOVAVG (mbrName [. "Mov Avg" = @MOVAVG(Sales. Example The following example is based on the Sample Basic database. the @MOVAVG function smooths sales data for the first six months of the year (Jan through Jun).11 Forecasting Functions Hyperion Essbase Calc Scripts @MOVAVG The @MOVAVG() function applies a moving n-term average to an input data set. @MOVAVG modifies a data set for smoothing purposes. and Apr. For example: Trailing Average 1 2 3 2 Centered Average 1 2 2 3 While calculating the moving average. use it within a FIX statement. If you use a Essbase member set function to generate a member list for the rangeList parameter (for example. @SIBLINGS). When you use @MOVAVG across a large range in a sparse dimension. average. For more information.Hyperion Essbase Calc Scripts Forecasting Functions 11 Notes The @MOVAVG function calculates a trailing. For example. Hyperion 11-5 . if one value out of three is #MISSING. you may need to increase the size of the calculator cache. consider the order in which Essbase sorts the generated member list. to ensure correct results. see the online Technical Reference topic for the member set function you are using. Although FIX is not required. rather than a centered. When you use @MOVAVG in a calculation script. using it may improve calculation performance. the @MOVAVG function skips #MISSING values and decreases the denominator accordingly. Essbase adds the remaining two values and divides the sum by two. 3. Assume that the Measures dimension contains an additional member. Mar. @MOVMAX modifies a data set for smoothing purposes. October .Jan:Jun). n [. the @MOVMAX function smooths sales data for the first six months of the year (Jan through Jun).December). "Mov Max" = @MOVMAX(Sales. Example The following example is based on the Sample Basic database. Each term in the set is replaced by a trailing maximum of n terms. The remaining values represent the trailing maximum for each group of three values.Feb) for Mov Max and the first two values for Sales are the same. rangeList]]) n . Syntax @MOVMAX (mbrName [. Essbase uses three values at a time to calculate the moving maximum. 11-6 Hyperion . The first two values (Jan.A positive integer value that represents the number of values that are used to calculate the moving maximum. The value for Mar represents the trailing maximum of Jan. and Apr. Mov Max. The value for Apr represents the trailing maximum of Feb. This example produces the following results: Sales Jan Feb Mar Apr May Jun 551 641 586 630 612 747 Mov Max 551 641 641 641 630 747 In this example. and Mar. In this example. Feb. and the first terms (the n-1 terms) are copies of the input data.11 Forecasting Functions Hyperion Essbase Calc Scripts @MOVMAX The @MOVMAX() function applies a moving n-term maximum (highest number) to an input data set. The default is 3. The results of @MOVMAX can be used with the @TREND function to forecast maximum sales data for a holiday season (for example. maximum. to ensure correct results. you may need to increase the size of the calculator cache. @MOVMAX calculates the maximum of the remaining three values. When you use @MOVMAX across a large range in a sparse dimension. When you use @MOVMAX in a calculation script. using it may improve calculation performance. If you use a Essbase member set function to generate a member list for the rangeList parameter (for example. use it within a FIX statement. Although FIX is not required. @SIBLINGS).Hyperion Essbase Calc Scripts Forecasting Functions 11 Notes The @MOVMAX function calculates a trailing. consider the order in which Essbase sorts the generated member list. Hyperion 11-7 . if one value out of four is #MISSING. @MOVMAX skips #MISSING values. For example. rather than a centered. For example: Trailing Maximum 1 2 3 3 Centered Maximum 1 2 3 3 While calculating the moving maximum. Assume that the Measures dimension contains an additional member.Feb) for Mov Med are the same as the first two values for Sales. The default is 3. the @MOVMED function smooths sales data for the first six months of the year (Jan through Jun). Syntax @MOVMED (mbrName [. Mov Med.11 Forecasting Functions Hyperion Essbase Calc Scripts @MOVMED The @MOVMED() function applies a moving n-term median (middle number) to an input data set. Essbase uses three values at a time to calculate the moving median. and Mar. and the first terms (the n-1 terms) are copies of the input data. Feb. Mar. 11-8 Hyperion . n [. Each term in the list is replaced by a trailing median of n terms.3. @MOVMED modifies a data set for smoothing purposes. Example The following example is based on the Sample Basic database. The remaining values represent the trailing median of each group of three values. This example produces the following results: Sales Jan Feb Mar Apr May Jun 551 641 586 630 612 747 Mov Med 551 641 586 630 612 630 In this example. The value for Apr represents the trailing median of Feb. In this example.A positive integer value that represents the number of values that are used to calculate the moving median. The first two values (Jan. The value for Mar represents the trailing median of Jan.Jan:Jun). "Mov Med" = @MOVMED(Sales. rangeList]]) n . and Apr. if one value out of four is #MISSING. to ensure correct results. For example: Trailing Median 1 2 3 2 Centered Median 1 2 2 3 If the group of values being used to calculate the median contains an even number of values. For example. use it within a FIX statement. the @MOVMED function averages the two numbers in the middle. If you use a Essbase member set function to generate a member list for the rangeList parameter (for example. median. Although FIX is not required. @SIBLINGS). @MOVMED calculates the median of the remaining three values. you may need to increase the size of the calculator cache.Hyperion Essbase Calc Scripts Forecasting Functions 11 Notes While calculating the moving median. When you use @MOVMED in a calculation script. rather than a centered. using it may improve calculation performance. the @MOVMED function skips #MISSING values. The @MOVMED function calculates a trailing. When you use @MOVMED across a large range in a sparse dimension. Hyperion 11-9 . consider the order in which Essbase sorts the generated member list. The default is 3.Jan:Jun). This example produces the following results: Sales Jan Feb Mar Apr May Jun 551 641 586 630 612 747 Mov Min 551 641 551 586 586 612 In this example.Feb) for Mov Min and the first two values for Sales are the same. Feb. The value for Apr represents the trailing minimum of Feb. The first two values (Jan. Each term in the list is replaced by a trailing minimum of n terms. The remaining values represent the trailing minimum for each group of three values. The value for Mar represents the trailing minimum of Jan. and the first terms (the n-1 terms) are copies of the input data. Syntax @MOVMIN (mbrName [. "Mov Min" = @MOVMIN(Sales. rangeList]]) n . Example The following example is based on the Sample Basic database.11 Forecasting Functions Hyperion Essbase Calc Scripts @MOVMIN The @MOVMIN() function applies a moving n-term minimum (lowest number) to an input data set.A positive integer value that represents the number of values that are used to calculate the moving minimum. n [. and Apr. Assume that the Measures dimension contains an additional member.3. Essbase uses three values at a time to calculate the moving minimum. 11-10 Hyperion . the @MOVMIN function smooths sales data for the first six months of the year (Jan through Jun). @MOVMIN modifies a data set for smoothing purposes. Mar. and Mar. In this example. Mov Min. The @MOVMIN function calculates a trailing. Hyperion 11-11 . @MOVMIN calculates the minimum of the remaining three values. minimum. @SIBLINGS). you may need to increase the size of the calculator cache. When you use @MOVMIN in a calculation script. For example: Trailing Minimum 1 2 3 2 Centered Minimum 1 2 2 3 If you use a Essbase member set function to generate a member list for the rangeList parameter (for example. the @MOVMIN function skips #MISSING values. use it within a FIX statement.Hyperion Essbase Calc Scripts Forecasting Functions 11 Notes While calculating the moving minimum. to ensure correct results. Although FIX is not required. rather than a centered. For example. When you use @MOVMIN across a large range in a sparse dimension. consider the order in which Essbase sorts the generated member list. using it may improve calculation performance. if one value out of four is #MISSING. "Mov Sum" = @MOVSUM(Sales. Each term of the set is replaced by a trailing sum of n terms. Feb. The value for Apr represents the trailing sum of Feb. and Mar.Feb) for Mov Sum and the first two values for Sales are the same. n [. The default is 3. rangeList]]) n . and Apr. In this example. and the first terms (the n-1 terms) are copies of the input data. The first two values (Jan. 11-12 Hyperion . Example The following example is based on the Sample Basic database. Essbase uses three values at a time to calculate the moving sum.Jan:Jun).3. Mov Sum.11 Forecasting Functions Hyperion Essbase Calc Scripts @MOVSUM The @MOVSUM function applies a moving n-term sum to an input data set. Syntax @MOVSUM (mbrName [. The value for Mar represents the trailing sum of Jan. The remaining values represent the trailing minimum for each group of three values. Assume that the Measures dimension contains an additional member. Mar. This example produces the following results: Sales Jan Feb Mar Apr May Jun 551 641 586 630 612 747 Mov Sum 551 641 1778 1857 1828 1989 In this example. the @MOVSUM function smooths sales data for the first six months of the year (Jan through Jun).A positive integer value that represents the number of values that are used to calculate the moving minimum. @MOVSUM modifies a data set for smoothing purposes. you may need to increase the size of the calculator cache.Hyperion Essbase Calc Scripts Forecasting Functions 11 Notes The @MOVSUM function calculates a trailing. if one value out of three is #MISSING. to ensure correct results. For example. For example: Trailing Sum 1 2 3 6 1 Centered Sum 2 3 3 While calculating the moving sum. @SIBLINGS). Although FIX is not required. @MOVSUM skips #MISSING values. When you use @MOVSUM across a large range in a sparse dimension. using it may improve calculation performance. If you use an Essbase member set function to generate a member list for the rangeList parameter (for example. rather than a centered. Essbase adds the remaining two values. Hyperion 11-13 . sum. When you use @MOVSUM in a calculation script. consider the order in which Essbase sorts the generated member list. use it within a FIX statement. Jan:Jun). @MOVSUMX modifies a data set for smoothing purposes.rangelist]] ) COPYFORWARD . This duplicates the behavior of the @MOVSUM function.Sets the member value to #MISSING until the n value is reached. @MOVSUMX provides several options that control how values are assigned to members that precede the n-term parameter.Jan:Jun). SumMiss = @MOVSUMX (TRAILMISSING. TRAILSUM . Example SumCopy = @MOVSUMX (COPYFORWARD.Copies the member value into the new member until the n value is reached.A positive integer value that represents the number of values that are used to calculate the moving minimum.3. Produce the following results: Sales Jan Feb Mar Apr May Jun 551 641 586 630 612 747 SumCopy 551 641 1778 1857 1828 1989 SumMiss #Missing #Missing 1778 1857 1828 1989 SumTrail 551 1192 1778 1857 1828 1989 11-14 Hyperion .n[. The default is 3. mbrName [. TRAILMISSING . When the n value is reached.Jan:Jun). SumTrail = @MOVSUMX (TRAILSUM.Sales.Sales. OLAP Server begins summing just those values n .11 Forecasting Functions Hyperion Essbase Calc Scripts @MOVSUMX The @MOVSUMX function applies a moving n-term sum to an input data set. then it will begin summing the value.Sums the trailing values. Unlike @MOVSUM.3. Syntax @MOVSUMX(COPYFORWARD | TRAILMISSING | TRAILSUM. regardless of whether the n value is reached or not. then it will begin summing the value.3.Sales. This example produces the following results: Sales Jan Feb Mar Apr May Jun 645 675 712 756 890 912 Sales Spline 632. s [. The default value is 1..82 Hyperion 11-15 . "Sales Spline" = @SPLINE(Sales.3. XmbrName . s .89 675. Assume that the Measures dimension contains an additional member. A spline is a mathematical curve that smooths or interpolates data.Hyperion Essbase Calc Scripts Forecasting Functions 11 @SPLINE The @SPLINE() function applies a smoothing spline to a set of data points. Syntax @SPLINE (YmbrName [. Sales Spline.2.2.82 724.0. and so on.74 784.A valid single member name that contains the independent variable values used (when crossed with rangeList) to construct the spline. based on a smoothness parameter of 2.29 852. The formula calculates the spline of Sales values for Jan through Jun. The default independent variable values are 0.Jan:Jun).A zero (0) or positive value that determines the smoothness parameter. XmbrName [.1.44 919. Example The following example is based on the Sample Basic database. rangeList]]]) YmbrName A valid single member name that contains the dependent variable values used (when crossed with rangeList) to construct the spline. 11 Forecasting Functions Hyperion Essbase Calc Scripts Notes Splines are smooth piecewise polynomials that can be used to represent functions over large intervals. The @SPLINE function calculates a smoothing cubic spline for (n > 0). If rangeList contains gaps in the data (for example: Jan. Feb. to ensure correct results.1. 11-16 Hyperion . use it within a FIX statement. that is. Mar. consider the order in which Essbase sorts the generated member list.2. Jun. Jul). it may improve calculation performance. Setting the smoothness parameter (s) to 0 produces an interpolating spline. Although using FIX is not required.5. be sure to specify XmbrName (for example: 0. a spline that fits the initial data exactly. rangeList must contain at least two values. in the result. Increasing s results in a smoother spline but a less exact approximation of the initial data. When you use @SPLINE across a large range in a sparse dimension. When you use @SPLINE in a calculation script. you may need to increase the size of the calculator cache. If you use a Essbase member set function to generate a member list for the rangeList parameter (for example. View the algorithm for the smoothing spline. Essbase replaces the #MISSING values of YmbrName with the spline values. where it would be impractical to use a single approximating polynomial. The @SPLINE function skips #MISSING values in YmbrName and XmbrName. @SIBLINGS).6) so that correct results are returned. .XfilterN [. constructs a mathematical model of the process based on these observations (that is. If values in weightList are #MISSING. report errors of the curve fitting.3. XforecastList Expression list that contains the underlying variable values for which the forecasting is sought. (last value in Xlist + 2). Xfilter1 [. for each sales figure in Ylist. up to the number of values in Ylist.} up to (last value in Xlist + the number of values in YforecastList) Hyperion 11-17 . choose the forecasting method to be used (for example.2. parameters]][. and so on. linear regression). The @TREND procedure considers a number of observations. for the linear regression method only. You can use weights to assign credibility coefficients to particular observations. Xlist weightList An expression list that contains weights for the data points in Ylist.parameters]]) Parameters Ylist An expression list that contains known observations. parameters]] [. [errorList]. [XforecastList]. If you do not specify Xlist. YforecastList. Weights for methods other than linear regression are ignored.. the default is 1. the values are assumed to be as follows: {(last value in Xlist + 1). fits a curve). Negative weights are replaced with their absolute values. For example. parameters]] [. Xlist may contain a value for associated time periods.Hyperion Essbase Calc Scripts Forecasting Functions 11 @TREND The @TREND() function calculates future values based on curve-fitting to historical values. If you do not specify XforecastList. method[. errorList Member list that represents the differences between the data points in Ylist and the data points on the line or curve (as specified for method). and specify certain data filters. and predicts values for a future observation.. for example. Syntax @TREND (Ylist. Yfilter1 [. [Xlist]. sales figures over a period of time. the default variable values are 1. An expression list that contains underlying variable values. method parameters] [. [weightList]. YfilterN [. c1]. In general. single exponential smoothing with parameter c (default c=0. where [t] is the length of the period. c2 (default c1=0. using the single parameter c.T]. c2=0.11 Forecasting Functions Hyperion Essbase Calc Scripts If you forecast consecutively from where Ylist stops. This is a two-parameter weight system and a linear subsequent approximation scheme.c1]. Method parameters must be numeric values. the weights are equal to 1 by default. not member names. This method uses its own weight system. c3.c] DES [[. c2=0. SES [.c3] 11-18 Hyperion .c2] TES [[[[. T=1). T (default c1=0. specify the new period with XforecastList. The first parameter controls weight distribution for the intercept.c2] . c2.t] standard linear regression with possible weights assigned to each data point and an optional seasonal adjustment period [t].2). If you want to move the forecasting period forward. triple exponential smoothing (Holt-Winters method) with optional parameters c1. c3=0. YforecastList A member list into which the forecast values are placed. Increasing this parameter gives more weight to early observations than to later ones.3). method A choice among: • • • • LR (linear regression) SES (single exponential smoothing) DES (double exponential smoothing) TES (triple exponential smoothing).2. This is a three-parameter weight system and a linear model with a multiplicative seasonal component.1. You might want to increase the weight if the corresponding observation is important. you do not need to specify XforecastList. or decrease the weight if the corresponding observation is an outlier or is unreliable. the second parameter controls weight distribution for the slope of the line fit. double exponential smoothing (Holt's method) with optional parameters c1.2.05. Method parameters vary depending on the method: LR [. Hyperion Essbase Calc Scripts Forecasting Functions 11 Xfilter1. based on the trend of the sales from January through April.. It forecasts sales data for May through December. This example produces the following results: Sales Jan Feb Mar Apr May Jun Jul Aug 2339 2298 2313 2332 2319 2318..2 Hyperion 11-19 .4 2317. XfilterN Use one or more of the following filter methods to scale Xlist: XLOG[...LR)..c] logarithmic change with shift c (x' = log(x+c)) (default c=1) exponential change with shift c (x' = exp(x+c)) (default c=0) power change with power c (x' = x^c) (default c=2) XEXP[. The method used is linear regression with no seasonal adjustment.May:Dec.8 2317.c] Example The following example is based on the Sample Basic database.c] YPOW[.).c] XPOW[. YfilterN Use one or more of the following filter methods to scale Ylist: YLOG[..c] logarithmic change with shift c (y' = log(y+c)) (default c=1) exponential change with shift c (y' = exp(y+c)) (default c=0) power change with power c (y' = y^c) (default c=2) YEXP[. Sales(@TREND(Jan:Apr.c] Yfilter1... consider the order in which Essbase sorts the generated member list. Essbase places strict requirements on the input data.4 2314. and errorList should contain the same number of values. with the interval (step) being a whole fraction of the period.8 Notes The @TREND function can be used only in calculation scripts. you must associate the @TREND formula with a member. not in outline formulas. 11-20 Hyperion . Xlist. In a calculation script. XforecastList and YforecastList should contain the same number of values. if you specify Xlist. The method and filter parameters must be numbers only. functions and member names are not allowed. the data must be equidistant. T/5.6 2316 2315. The XforecastList parameters should also contain multiples of the interval. When you use the LR method with seasonal adjustments or when you use the TES method. T (for example. @SIBLINGS). If you use a Essbase member set function to generate a member list for this function. weightList. With these methods. Ylist. input data cannot contain #MISSING values. T/2). see the online Technical Reference topic for the member set function you are using. For more information. (for example.11 Forecasting Functions Hyperion Essbase Calc Scripts Sep Oct Nov Dec 2316. Also. @TREND ignores #MISSING values during calculation of the trend. to ensure correct results. 1998 and 1999. Do the Essbase results match your expectations? If not. clear all data from the HLandS2 database. West. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSTrend SS_Trend. Retrieve into this sheet. Perform a retrieval and review the results in the “2000 Budget” column. run the CSTrend calc script.xls 1) 2) From Essbase Application Manager. South and Central) for 2000. The budgeted sales are predicted using a linear regression of actual sales for 1997. The 2000 Budget values have not been calculated. modify the CSTrend calc script and rerun the calculation until you get the expected results. Close the spreadsheet. 1998 and 1999. The budgeted sales are predicted using a linear regression of actual sales for 1997. Save the new script as CSTrend. South and Central) for 2000. For this exercise. you create a calc script that forecasts the budgeted sales for the four sales regions (East. Lock and send the data in the Lock&Send sheet to the HLandS2 database. 3) 4) 5) 6) 7) 8) Hyperion 11-21 .Hyperion Essbase Calc Scripts Forecasting Functions 11 Exercise 11-1: Applying Forecasting Functions In this exercise. From the Calc&Retrieve sheet. West. Switch to the Calc&Retrieve sheet. Open the SS_Trend spreadsheet. Create a calc script to calculate the budgeted sales for the four sales regions (East. 11-22 Hyperion . or calculating future values. interpolating. Forecasting functions are often used in planning. analysis.11 Forecasting Functions Hyperion Essbase Calc Scripts Unit Summary Forecasting functions manipulate data for the purpose of smoothing. and modeling applications. you will be able to: • • Explain the purpose and use of Statistical functions to generate member lists Practice using the Statistical functions in a series of incremental exercises .12 Statistical Functions Chapter Objectives By the end of this chapter. An integer value that defines the generation or level number from which the ancestor value is returned. SKIPNONE . functions. These functions are often used in sales and marketing applications. A positive integer defines a generation number.Ignores all 0 values SKIPBOTH . all of which return numeric values. A value of 0 or a negative integer defines a level number. Specifies a single member. variable names.Ignores all #MISSING values SKIPZERO . Statistical Function Parameters There are common parameters associated with the various Statistical functions: dimName mbrName genLevNum Single dimension name specification. explist2 SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH 12-2 Hyperion . and numeric expressions.12 Statistical Functions Hyperion Essbase Calc Scripts Generating Lists Using Statistical Functions Statistical functions calculate advanced statistical values.Ignores all 0 and #MISSING values expList. Comma-delimited list of members. Used in conjunction with an expList parameter. this parameter indicates how missing and zero values are to be processed.Includes in the operation all values specified in expList regardless of their content SKIPMISSING . expList1. such as correlation or variance. @COUNT @MEDIAN @MODE @RANK @STDEV @STDEVP @STDEVRANGE @VARIANCE @VARIANCEP Hyperion 12-3 . The rank of the specified members or the specified value among the values in the specified data set. Function @CORRELATION Returns The correlation coefficient between two parallel data sets. The median of the specified data set. Each function is also described. in this chapter.Hyperion Essbase Calc Scripts Statistical Functions 12 Summary of Statistical Functions This table summarizes the Statistical Functions. The statistical variance of a specified data set that represents a population. The standard deviation of a specified data set that represents a sample of a population. in detail. The mode of the specified data set. The number of data values in the specified data set. The statistical variance of a specified data set that represents a sample of a population. The standard deviation of the specified member across the specified data set that represents a sample of a population. The standard deviation of a specified data set that represents a population. 12 Statistical Functions Hyperion Essbase Calc Scripts @CORRELATION The @CORRELATION() function returns the correlation coefficient between two parallel data sets (expList1 and expList2). Syntax @CORRELATION (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. expList2) Example The following example is based on the Sample Basic database. Sales Correl. This example uses the @RANGE function to generate expList1 and expList2: FIX(June) "Sales Correl"=@CORRELATION(SKIPNONE. @RANGE(Sales. expList1. The calculation script calculates the correlation coefficient for a set of members (Sales for the children of Qtr1 and Qtr2). Assume that the Measures dimension contains an additional member.@RANGE(Sales.200368468 12-4 Hyperion . the results are placed in Sales Correl->Jun. ENDFIX This example produces the following results: Sales Jan Feb Mar Apr May Jun Sales Correl 678 645 675 712 756 890 #MI #MI #MI #MI #MI 0.@CHILDREN(Qtr1)).@CHILDREN(Qtr2))) . The correlation coefficient determines the relationship between two data sets. Because the calculation script fixes on Jun. @SIBLINGS).) SKIPZERO and SKIPBOTH work similarly. the value's corresponding value in expList2 is treated as #MISSING.Hyperion Essbase Calc Scripts Statistical Functions 12 Notes The expList1 and expList2 parameters must have the same number of data points. unless SKIPMISSING or SKIPBOTH is specified. or (3) have a standard deviation of 0 (all values are constant). (That is. and SKIPMISSING is specified. to ensure correct results. The @CORRELATION function returns values from -1 to 1. If a value in expList1 is #MISSING. Hyperion 12-5 . consider the order in which Essbase sorts the generated member list. The @CORRELATION function treats #MISSING values as zero (0) values. If expList1 and expList2 have different numbers of data points. If you use a Essbase member set function to generate a member list for this function (for example. @CORRELATION returns #MISSING. both values are deleted before calculation. The @CORRELATION function returns #MISSING if expList1 and expList2 (1) are empty. (2) contain only #MISSING values. 12-6 Hyperion .@CHILDREN(Product))). Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product Prod Count Product 678 #MI 663 587 #MI 2479 3 Budget 640 530 510 620 #MI 2300 4 Notes The @COUNT function always returns an integer greater than or equal to 0. Prod Count.@RANGE(Sales.12 Statistical Functions Hyperion Essbase Calc Scripts @COUNT The @COUNT() function returns the number of data values in the specified data set. expList) Example Example The following example is based on the Sample Basic database. Since SKIPMISSING is specified in the calculation script. Assume that the Measures dimension contains an additional member. the #MI values are skipped during the product count. Syntax @COUNT (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. This example calculates the count of all products for which a data value exists and uses the @RANGE function to generate expList: FIX(Product) "Prod Count" = @COUNT(SKIPMISSING. ENDFIX This example produces the following report. the two middle numbers in the set (530 and 620) are averaged to create the median (575). Median. Half the numbers in the data set are larger than the median.Hyperion Essbase Calc Scripts Statistical Functions 12 @MEDIAN The @MEDIAN() function returns the median (the middle number) of the specified data set. ENDFIX This example produces the following results: Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product Median Product 678 #MI 663 587 #MI 2479 663 Budget 640 530 510 620 #MI 2300 575 Because SKIPBOTH is specified in the calculation script. the #MI values are skipped. to calculate Median->Product->Budget. Syntax @MEDIAN (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. This example calculates the median sales values for all products and uses the @RANGE function to generate expList: FIX (Product) Median = @MEDIAN(SKIPBOTH. In the Budget scenario.@RANGE(Sales. Hyperion 12-7 . the remaining four products create an even-numbered data set. Assume that the Measures dimension contains an additional member.@CHILDREN(Product))). and half are smaller. expList) Example The following example is based on the Sample Basic database. @MEDIAN treats #MISSING values as 0 unless SKIPMISSING or SKIPBOTH is specified. use the @RANGE function to cross the member with the list of members (for example. you may need to increase the size of the calculator cache. When you use @MEDIAN in a calculation script. use it within a FIX statement. to cross Sales with the children of 100). When expList contains an even number of values. 12-8 Hyperion . using it may improve calculation performance.12 Statistical Functions Hyperion Essbase Calc Scripts Notes If the member you are calculating and expList are not in the same dimension. When you use @MEDIAN across a large range in a sparse dimension. Although FIX is not required. the @MEDIAN function calculates the average of the two middle numbers. @MEDIAN sorts expList in ascending order before calculating the median. 3.3.@RANGE(Units.2.@CHILDREN(Central))).3. ENDFIX This example produces the following results: Actual Units Illinois Ohio Wisconsin Missouri Iowa Colorado Central Mode Central 3 2 3 #MI 0 6 14 3 Notes When two or more values in expList occur at the same frequency. expList) Example The following example calculates the mode of the units sold for the Central region and uses the @RANGE function to generate expList: FIX (Actual. Essbase sorts the list of values in ascending order and chooses the lowest value that occurs with the most frequency as the mode.2.3] and chooses the value [2] as the mode.2.2.1. if expList contains [2. Hyperion 12-9 .3.2.3. For example.3. Syntax @MODE (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. Essbase sorts the list as [1.2.2. Central) "Mode" = @MODE(SKIPMISSING.Hyperion Essbase Calc Scripts Statistical Functions 12 @MODE The @MODE() function returns the mode (the most frequently occurring value) in the specified data set.3]. you may need to increase the size of the calculator cache. If you specify SKIPMISSING or SKIPBOTH and all values in expList are #MISSING. if expList contains [2. If #MISSING is the mode of expList. @MODE returns #MISSING. use it within a FIX statement. @MODE returns #MISSING unless SKIPMISSING or SKIPBOTH is specified. @MODE returns #MISSING.14]. @MODE returns 2 as the mode. When you use @MODE across a large range in a sparse dimension.10.12 Statistical Functions Hyperion Essbase Calc Scripts If expList contains no duplicate values. Although FIX is not required. When you use @MODE in a calculation script. the @MODE function returns the smallest value in the list as the mode. using it may improve calculation performance. If you specify SKIPZERO or SKIPBOTH and all values in expList are 0. 12-10 Hyperion . For example.4.7. Essbase ranks the sales values for a set of products: "Sales Rank" = @RANK(SKIPBOTH.Hyperion Essbase Calc Scripts Statistical Functions 12 @RANK The @RANK() function returns the rank of the specified members or the specified value among the values in the specified data set. expList) value . 15341. 4255.@LEVMBRS(Product. there are no values to compare. or a constant value for which the rank is calculated. @RANGE(Sales. value.1))). the #MI value for Sales->Diet Drinks is not included in the ranked list: Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks 678 551 663 587 #MI Sales Rank 1 4 2 3 #MI Notes After SKIP processing.Sales. This example produces the following report. Sales Rank. 6556. Example The following example is based on the Sample Basic database. 9650. the @RANK function sorts the data set in descending order (for example. The rank of a value is equivalent to its position (its rank) in the sorted data set.either the member or member combination for which the rank is calculated. Since SKIPBOTH is specified in the formula. after SKIP processing. 15341 is ranked 1. 1989 is ranked 5) An input value of #MISSING returns #MISSING. 1989). Assume that the Measures dimension contains an additional member. The rank of a value identifies its position in the sorted data set (for example. Syntax @RANK (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. #MISSING is also returned if. Hyperion 12-11 . 2] and then ranks: [5] has a rank of 1.6. Essbase inserts the constant value in the list and then ranks it accordingly.4.2. no value has a rank of 4. however. For example. When you use @RANK across a large range in a sparse dimension.2] Inserts [3] in the list [13. For example. and [2] has a rank of 3.6. it may improve calculation performance. In this case. [3] has a rank of 4.2.2] Ranks [3] in the list: in this case. use it within a FIX statement.5]. if a list of values contains [2. Essbase first sorts the list [5.3.4. and you want to rank a value of [3] in this list. the presence of duplicate values affects the rank numbers. 12-12 Hyperion .4.4. When you use @RANK in a calculation script.13].4.12 Statistical Functions Hyperion Essbase Calc Scripts The @RANK function assigns the same rank to duplicate values. if a list of values contains [2. If value is a constant value and that value is not included in expList. you may need to increase the size of the calculator cache. [4] has a rank of 2.6. Essbase: • • • Sorts the list in descending order [13. Although using FIX is not required. @CHILDREN(Product))).Hyperion Essbase Calc Scripts Statistical Functions 12 @STDEV The @STDEV() function calculates the standard deviation of the specified data set. Assume that the Measures dimension contains an additional member.73 Budget 640 530 510 620 #MI 2300 64. ENDFIX This example produces the following results: Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product StdDev Product 678 551 663 587 #MI 2479 60. Syntax @STDEV (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. expList) Example The following example is based on the Sample Basic database. This example calculates the standard deviation (based on a sample of a population) of the sales values for all products.@RANGE(Sales. Standard deviation is a measure of how widely values are dispersed from their mean (average).55 Hyperion 12-13 . The calculation assumes that the data set represents a sample of a population. StdDev. FIX (Product) "StdDev" = @STDEV(SKIPBOTH. @STDEV assumes that expList represents a sample of a population. use @STDEVP. If you want expList to represent the entire population. @STDEV is calculated using the "nonbiased" or "n-1" method. 12-14 Hyperion . @STDEV is the square root of the variance calculated for the same data set using @VARIANCE. For large samples. The only difference between the functions is the SKIP parameter in the new @STDEV function. the functions return similar values. Although the old @STDDEV function is supported for migration purposes. you can no longer select it in the Calc Script Editor or Formula Editor.12 Statistical Functions Hyperion Essbase Calc Scripts Notes The @STDEV function replaces the @STDDEV function. use @STDEV. Hyperion 12-15 . Standard deviation is a measure of how widely values are dispersed from their mean (average). expList) Example The following example is based on the Sample Basic database.@CHILDREN(Product))). If you want expList to represent a sample of a population. This example calculates the standard deviation (based on the entire population) of the sales values for all products.Hyperion Essbase Calc Scripts Statistical Functions 12 @STDEVP The @STDEVP() function calculates the standard deviation of the specified data set. Assume that the Measures dimension contains an additional member.90 Notes @STDEVP assumes that expList represents the entire population. For large samples. ENDFIX This example produces the following results: Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product StdDevP Product 678 551 663 587 #MI 2479 52.@RANGE(Sales. FIX (Product) "StdDevP" = @STDEVP(SKIPBOTH. StdDevP.59 Budget 640 530 510 620 #MI 2300 55. Syntax @STDEVP (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. The calculation assumes that the data set represents the population. the functions return similar values. 12 Statistical Functions Hyperion Essbase Calc Scripts @STDEVP is the square root of the variance calculated for the same data set using @VARIANCEP. @STDEVP is calculated using the "biased" or "n" method. 12-16 Hyperion . Sales. rangeList . rangeList]) mbrName . If rangeList is not specified. FIX (Product) "StdDev" = @STDEVRANGE(SKIPBOTH. Standard deviation is a measure of how widely values are dispersed from their mean (average).A valid member name. member set functions. StdDev. and range functions from the same dimension.Any valid single member name or member combination. ENDFIX This example produces the following results: Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product StdDev Product 678 551 663 587 #MI 2479 60. The calculation assumes that the data set represents a sample of a population.55 Hyperion 12-17 . Example The following example is based on the Sample Basic database. This example calculates the standard deviation (based on a sample of a population) of the sales values for all products. Essbase uses the level 0 members from the dimension tagged as Time. Assume that the Measures dimension contains an additional member. or a function that returns a single member or member combination.Hyperion Essbase Calc Scripts Statistical Functions 12 @STDEVRANGE The @STDEVRANGE() function calculates the standard deviation of all values of the specified member across the specified data set. Syntax @STDEVRANGE (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. a comma-delimited list of member names. mbrName [.73 Budget 640 530 510 620 #MI 2300 64.@CHILDREN(Product)). @STDEVRANGE is calculated using the "unbiased" or "n-1" method. you can no longer select it in the Calc Script Editor or Formula Editor. Although the old @STDDEVRANGE function is supported for migration purposes. The specified mbrName is crossed with rangeList to obtain the sample across which the standard deviation is calculated. 12-18 Hyperion .12 Statistical Functions Hyperion Essbase Calc Scripts Notes The @STDEVRANGE function replaces the @STDDEVRANGE function. The only difference between the functions is the SKIP parameter in the new @STDEVRANGE function. which calculates the variance (difference) between two members.58 Budget 640 530 510 620 #MI 2300 4166. Hyperion 12-19 . ENDFIX This example produces the following results: Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product SalesVar Product 678 551 663 587 #MI 2479 3687. FIX (Product) "SalesVar" = @VARIANCE(SKIPBOTH. This example uses the @RANGE function to generate expList.67 Notes @VARIANCE is different from @VAR.@RANGE(Sales.Hyperion Essbase Calc Scripts Statistical Functions 12 @VARIANCE The @VARIANCE() function calculates the statistical variance of the specified data set. and calculates the variance of the sales values for a product family. Assume that the Measures dimension contains an additional member.@CHILDREN(Product))). Variance is a measure of the dispersion of a set of data points around their mean (average) value. The calculation assumes that the data set represents a sample of a population. SalesVar. expList) Example The following example is based on the Sample Basic database. Syntax @VARIANCE (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. use @VARIANCEP. If you want expList to represent the entire population. @VARIANCE assumes that expList represents a sample of the population.12 Statistical Functions Hyperion Essbase Calc Scripts @VARIANCE is the square of the standard deviation calculated for the same data set using @STDEV. 12-20 Hyperion . @VARIANCE is calculated with the "unbiased" or "n-1" method. 00 Notes @VARIANCEP is different from @VARPER.69 Budget 640 530 510 620 #MI 2300 3125. Assume that the Measures dimension contains an additional member. This example uses the @RANGE function to generate expList and calculates the variance of the sales values for a product family. The calculation is based upon the entire population. Variance is a measure of the dispersion of a set of data points around their mean (average) value. Syntax @VARIANCEP (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH. FIX (Product) "SalesVar" = @VARIANCEP(SKIPBOTH. ENDFIX This example produces the following results: Actual Sales Colas Root Beer Cream Soda Fruit Soda Diet Drinks Product SalesVar Product 678 551 663 587 #MI 2479 2765. expList) Example Example The following example is based on the Sample Basic database.@CHILDREN(Product))).Hyperion Essbase Calc Scripts Statistical Functions 12 @VARIANCEP The @VARIANCEP() function calculates the statistical variance of the specified data set.@RANGE(Sales. Hyperion 12-21 . which calculates the percent variance (difference) between two members. SalesVar. @VARIANCEP assumes that expList represents the entire population. 12-22 Hyperion .12 Statistical Functions Hyperion Essbase Calc Scripts @VARIANCEP is the square of the standard deviation calculated for the same data set using @STDEVP. If you want expList to represent a sample of the population. @VARIANCEP is calculated using the "biased" or "n" method. use @VARIANCE. Sales have been entered at the city level.xls 1) From Essbase Application Manager. and determine if the Sales Ranks match this order. Sales have been entered at the city level. Perform a retrieval. Do the “Sales Ranks” for the states appear correct? If not. Close the spreadsheet. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSRank SS_Rank. The Sales and Sales Rank for the states values have not been calculated. clear all data from the HLandS2 database. Create a calc script to calculate the rank for the sales of each state. Sort the data in descending Sales order. Lock and send the data in the Lock&Send sheet to the HLandS2 database. Save the new script as CSRank. run the CSRank calc script. Switch to the Calc&Retrieve sheet.Hyperion Essbase Calc Scripts Statistical Functions 12 Exercise 12-1: Applying Statistical Functions In this exercise. Open the SS_Rank spreadsheet. For this exercise. 2) 3) 4) 5) 6) 7) ✍ 8) Hyperion 12-23 . modify the CSRank calc script and rerun the calculation until you get the expected results. From the Calc&Retrieve sheet. you create a calc script to calculate the rank for the sales of each state. Retrieve into this sheet. 12-24 Hyperion .12 Statistical Functions Hyperion Essbase Calc Scripts Unit Summary Statistical functions calculate advanced statistical values. These functions are often used in sales and marketing applications. such as correlation or variance. you will be able to: • • Explain the purpose and use of Date and Time functions to generate member lists Practice using the Date and Time functions in a series of incremental exercises .13 Date and Time Functions Chapter Objectives By the end of this chapter. 13-2 Hyperion .13 Date and Time Functions Hyperion Essbase Calc Scripts Using Date and Time Functions The date function converts date strings to numbers that can be used in calculation formulas. @TODATE. There is one Date and Time function. which converts date strings to numbers. for those members. This example produces the following results: Marketing New Marketing 9 Intro Date_12-101996 200-30 10 200-40 Intro Date_10-011996 400-10 10 10 9 9 400-20 10 9 Hyperion 13-3 . either "mm-dd-yyyy" or "dd-mm-yyyy".Hyperion Essbase Calc Scripts Date and Time Functions 13 @TODATE The @TODATE() function converts date strings to numbers that can be used in calculation formulas. dateString) formatString .The date string. “New Marketing” (IF (@ATTRIBUTEVAL("Intro Date") > @TODATE("mm-dd-yyyy". dateString .9. Syntax @TODATE (formatString. ENDIF.The format of the date string.). 1970. January 1. Essbase converts the date strings to numbers before it calculates. Example The following example is based on the Sample Basic database. In order to process the formula. This formula searches for members with an Intro Date attribute member that is later than 6-30-96 and. “New Marketing”. calculates “New Marketing” as Marketing reduced by 10 percent. @TODATE converts date strings into the number of seconds elapsed since midnight."06-30-1996")) Marketing * . Assume that the Measures dimension contains an additional member. 13 Date and Time Functions Hyperion Essbase Calc Scripts Intro Date_07-261996 Intro Date_06-261996 200-20 10 9 300-10 10 9 300-20 300-30 Intro Date_04-011996 100-20 10 10 10 9 9 10 100-30 Intro Date_03-251996 Intro Date_09-271995 100-10 10 10 10 10 200-10 10 10 Notes If you specify a date string that is earlier than January 1. 13-4 Hyperion . @TODATE returns an error. The latest date string supported by @TODATE is January 1. 1970. 2038 (01-012038). the budgeted marketing expense will be an increase of 10%. run the CSTodate calc script. the budgeted marketing expense will be a decrease of 10%. modify the CSTodate calc script and rerun the calculation until you get the expected results. For products introduced on or after January 1.Hyperion Essbase Calc Scripts Date and Time Functions 13 Exercise 13-1: Applying the Date & Time Function In this exercise. The budgeted marketing expenses are calculated in comparison to the actual marketing expenses for December 1999. 1996. Switch to the Calc&Retrieve sheet. the budgeted marketing expense will be a decrease of 10%. For all other products. 1997. Open the SS_ToDate spreadsheet. Save the new script as CSTodate. 1997. For products introduced on or after January 1. the budgeted marketing expense will be an increase of 10%. Retrieve into this sheet. Perform a retrieval. the budgeted marketing expense is equal to the 1999 actual marketing expense. Lock and send the data in the Lock&Send sheet to the HLandS2 database. The Budget 2000 Marketing values are not available. For this exercise.xls 1) From Essbase Application Manager. Do the 2000 Budget values match expected results? If not. clear all data from the HLandS2 database. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSTodate SS_ToDate. Create a calc script to calculate the budgeted marketing expense for New York in December 2000. 1996. The budgeted marketing expenses are calculated in comparison to the actual marketing expenses for December 1999. Close the spreadsheet. For all other products. For products introduced prior to July 6. For products introduced prior to July 6. the budgeted marketing expense is equal to the 1999 actual marketing expense. From the Calc&Retrieve sheet. you create a calc script that calculates the budgeted marketing expense for New York in December 2000. 2) 3) 4) 5) 6) 7) Hyperion 13-5 . 13 Date and Time Functions Hyperion Essbase Calc Scripts 13-6 Hyperion . 14 Miscellaneous Functions Chapter Objectives By the end of this chapter. you will be able to: • • Explain the purpose and use of Miscellaneous functions to generate member lists Practice using the Miscellaneous functions in a series of incremental exercises . you can specifies whether Essbase calculates a formula in cell mode or block mode and whether Essbase calculates a formula bottom-up or top-down. Returns a character string that is the result of appending one character string to another character string. Returns the requested substring of characters from an existing source string. Each function is also described. Function @CALCMODE @CONCATENATE Enables the choice of an execution mode of a formula. in this chapter. Passes the enclosed string or member name as a string to another function. @NAME @SUBSTRING 14-2 Hyperion . @CONCATENATE and @SUBSTRING enable manipulation of character strings. in detail.14 Miscellaneous Functions Hyperion Essbase Calc Scripts Using Miscellaneous Functions Essbase includes two types of miscellaneous functions. Summary of Miscellaneous Functions This table summarizes the Miscellaneous Functions. Using @CALCMODE. To specify both types of modes.Hyperion Essbase Calc Scripts Miscellaneous Functions 14 @CALCMODE The @CALCMODE function enables the choice of an execution mode of a formula.Turns on the block calculation mode TOPDOWN . Within one @CALCMODE specification. 14-3 . Top-down and bottom-up modes are mutually exclusive. or database level using the configuration setting CALCMODE. application. you can specify only one option. Syntax @CALCMODE (CELL|BLOCK|TOPDOWN|BOTTOMUP) CELL .Turns on the cell calculation mode BLOCK . for example: @CALCMODE (CELL) @CALCMODE (TOPDOWN) You can also set CALCMODE BLOCK or CALCMODE BOTTOMUP at the server.Turns on the bottom-up calculation mode Notes @CALCMODE can control two types of modes: Whether a formula is calculated in block calculation or cell calculation mode when calculating formulas that contain certain functions (in particular the @ISMBR function) Whether a formula assigned to a sparse member is calculated in bottom-up or top-down mode Hyperion H H Cell and block modes are mutually exclusive. perform the instruction twice.Turns on the top-down calculation mode BOTTOMUP . Essbase calculates each cell sequentially. Essbase groups the cells within a block and simultaneously calculates the cells in each group. In contrast. Block calculation mode is fast. a top-down calculation calculates the formula on all potential data blocks with the member. The calculation begins with the lowest existing block number and works up through each subsequent block until the last existing block is reached. Essbase performs a top-down calculation for that member. Essbase determines which existing data blocks need to be calculated before it calculates the database. 14-4 Hyperion . Using cell calculation mode. For a bottom-up calculation. If the database outline contains a complex member formula. in some cases top-down calculations are necessary to ensure that calculation results are correct. if the formula is to be calculated top-down. Essbase logs a message in the application log file. When a formula is compiled. See Example 4. A top-down calculation may be less efficient than a bottom-up calculation because more blocks may be calculated than is necessary. but you must carefully consider data dependencies within the block to ensure that the resulting data is accurate. following the calculation order. Knowing When Essbase uses Cell or Block Mode and Topdown or Bottom-up Mode When Essbase compiles a formula. Although a top-down calculation is less efficient than a bottom-up calculation. Essbase then calculates only the blocks that need to be calculated during the full database calculation. it prints a message in the application log file explaining the mode of execution for the formula similar to the following message: Formula on member Profit % will be executed in CELL and TOPDOWN mode. Understanding Bottom-Up and Top-Down Calculation Modes Essbase uses one of two calculation methods to do a full calculation of a database outline: bottom-up calculation (the default) or top-down calculation.14 Miscellaneous Functions Hyperion Essbase Calc Scripts Description Understanding Block Calculation and Cell Calculation Modes Using block calculation mode. which is based on the order of the dense dimensions in the outline. By default. For a complex formula such as A = B->D + C->D. Most data dependency issues with block calculation mode occur when a formula contains IF ELSE or IF ELSEIF conditions. Understanding Data Dependency Issues With Block Calculation Mode Data dependency occurs if the accurate calculation of one or more members depends on another member or other on members being calculated previously. data dependencies can occur in other formulas. Essbase performs a topdown calculation because every possible combination of A must be examined to see whether B->D or C->D exists. 14-5 . A is calculated only if B or C exists in the database. no message is written in the application log file. for example. Essbase uses cell calculation mode for formulas containing: @ANCEST @CURRMBR @ISMBR on a dense member @MDANCESTVAL @MDPARENTVAL @MDSHIFT @NEXT @PARENT @PARENTVAL @PRIOR @SANCESTVAL @SPARENTVAL @SHIFT Hyperion H H H H H H H H H H H H H For all other formulas. application. The dependency of the formula on B and C is known before the calculation is started. for a simple formula such as A = B + C. By default. or database level using the configuration setting CALCMODE. Essbase uses block calculation mode by default. when using the @PRIOR function. However.Hyperion Essbase Calc Scripts Miscellaneous Functions 14 When Essbase determines that the formula will be executed in block and bottom-up mode. Essbase does a bottomup calculation. You can also set CALCMODE BLOCK or CALCMODE BOTTOMUP at the server. The second group contains the members that satisfy the ELSE or ELSEIF conditions. See Example 2. The first group contains the members that satisfy the IF condition. Hyperion . See Example 1. See Example 3 for an example of data dependency in a formula containing the @PRIOR function. Dependent members are in the second group. placing the members that satisfy the ELSEIF condition in the first group and the members that satisfy subsequent ELSEIF or ELSE conditions in the second group. Understanding Other Data Dependency Issues Data dependencies can occur in formulas that do not contain IF ELSE conditions. 14-6 H H If an IF condition has multiple ELSEIF conditions. If a formula contains data dependencies. ensure that the following conditions are met: Members on which the accurate calculation of other members depends are in the first group. Essbase simultaneously calculates the members in the first group before simultaneously calculating the members in the second group.14 Miscellaneous Functions Hyperion Essbase Calc Scripts Data Dependency Issues With IF ELSE and IF ELSEIF When Essbase uses block calculation mode to calculate a formula that contains IF ELSE or IF ELSEIF conditions. it separates the members being calculated into two groups. Essbase evaluates each ELSEIF condition. e. Jan. IF(@ISMBR(Feb)) "Budget Sales"=100. Feb is the only member that satisfies the IF condition. Because this is a formula containing @ISMBR applied to a dense member (Budget Sales). Example 2. Hyperion 14-7 . Mar). Feb is assigned the new value (100). Example 1 Consider a database with two dense dimensions.Hyperion Essbase Calc Scripts Miscellaneous Functions 14 Examples Example 1. ENDIF. "Budget Sales" ( @CALCMODE(BLOCK). Example 4 illustrates use of the BOTTOMUP and TOPDOWN options. ELSE "Budget Sales"=Feb+10. After calculating Feb. Mar is assigned the new value for Feb (100) plus ten. Jan is assigned the pre-existing value for Feb (20) plus ten. Feb. Time and Accounts. You can use the @CALCMODE(BLOCK) function to specify block calculation mode for this formula.The time blocks are calculated sequentially (i. Essbase calculates the members Jan and Mar to have the new value for Feb (100) plus ten. With @Calcmode(Block) . and Example 3 illustrate use of the BLOCK and CELL options of the @CALCMODE function. by default Essbase uses cell calculation mode..Essbase calculates the members satisfying the IF condition first. In this example. The following formula is placed on the Budget Sales member of the Accounts dimension.) The following table shows the Budget Sales values before execution and compares the values that would be generated by running the calc script excluding and including the @Calcmode command: Before Execution Jan Feb Mar 10 20 30 Without @Calcmode 30 100 110 With @Calcmode 110 100 110 Without @Calcmode(Block) . by default Essbase uses cell calculation mode. ELSE "Budget Sales"=100. Mar is assigned the new value for Feb (100) plus twenty. You can use the @CALCMODE(BLOCK) function to specify block calculation mode for this formula. With @Calcmode(Block) .14 Miscellaneous Functions Example 2 Hyperion Essbase Calc Scripts Now consider the same database as in Example 1.e. Jan is assigned the pre-existing value for Feb (20) plus ten. because this is a formula containing @ISMBR applied to a dense dimension member (Budget Sales). Hyperion Essbase calculates the members in the following order: Mar. but we place the following formula on the Budget Sales member of the Accounts dimension. followed by the members satisfying the ELSE condition. IF(@ISMBR(Mar)) "Budget Sales"=Feb+20. Jan. 14-8 Hyperion .) The following table shows the Budget Sales values before execution and compares the values that would be generated by running the calc script excluding and including the @Calcmode command: Before Execution Jan Feb Mar 10 20 30 Without @Calcmode 30 100 120 With @Calcmode 30 100 40 Without @Calcmode(Block) . Feb.. Mar).Essbase calculates the members satisfying the IF condition first. "Budget Sales" ( @CALCMODE(BLOCK). followed by the members satisfying the ELSEIF condition. Feb. Jan. ELSEIF(@ISMBR(Jan)) "Budget Sales"=Feb+10.The time blocks are calculated sequentially (i. In this example. As in Example 1. ENDIF. Feb is assigned the new value (100). “Opening Inventory”( @CALCMODE(CELL) "Opening Inventory"=@PRIOR("Ending Inventory")+10. Hyperion 14-9 . "Ending Inventory"="Opening Inventory".Values for Jan is calculated first. and finally Mar is calculated. Essbase calculates the members simultaneously.Hyperion Essbase Calc Scripts Example 3 Miscellaneous Functions 14 Consider the following calc script to calculate the members Opening Inventory and Ending Inventory using the @PRIOR function.) The following table shows the inventory values before execution and compares the values that would be generated by running the calc script excluding and including the @Calcmode command: Before Execution Opening Jan Feb Mar #MI #MI #MI Ending #MI #MI #MI Without @Calcmode Opening 10 10 10 Ending 10 10 10 With @Calcmode Opening 10 20 30 Ending 10 20 30 Without @CALCMODE . With @CALCMODE . taking the previous month's Ending Inventory #MISSING value as 0 for all member combinations and adding 10.A block calculation mode is used. then Feb values are calculated using ending value for Jan. 10 Comment 14-10 Hyperion .10. calculating a formula top-down versus bottom-up may involve two issues: performance (reflecting the number of calculations that must be made) and accuracy.10 Comment Mar 400 450 400 440 The following formula is calculated top-down. The following formula is calculated bottom-up.10 No calculation is performed 400*1. Budget=Actual*1. This bottom-up calculation calculates two values. This example compares calculation results to illustrate both of these issues. Budget=Actual*1.10.10 200*1. based on existing combinations of Budget. with the following results: Before Execution Actual Jan Feb #MI 200 Budget 50 #MI After Execution Actual #MI 200 Budget #MI #MI #MISSING*1.10 400*1. considering all potential combinations of Budget. with the following results: Before Execution Actual Jan Feb Mar #MI 200 400 Budget 50 #MI 450 After Execution Actual #MI 200 400 Budget #MI 220 440 #MISSING*1. This top-down calculation calculates three values.14 Miscellaneous Functions Example 4 Hyperion Essbase Calc Scripts Depending on the formula and the structure of the data. @CALCMODE(BOTTOMUP). @CALCMODE(TOPDOWN). The following function statement returns string values starting with the current member of the Year dimension. if the current member being calculated is 100-10. or a function that returns a string or single member name String2 . you can nest multiple instances of the @CONCATENATE function. String2) String1 . for example.@CURRMBR(Measures))) Hyperion 14-11 . Syntax @CONCATENATE (String1. if the current members being calculated are Qtr1 and Sales. or a function that returns a string or single member name Examples The following examples are based on the Sample Basic database: Example 1 The following function statement puts the string Product in front of the name of the member currently being processed in the Measures dimension.@CURRMBR(Product)) Example 2 To concatenate more than two strings. followed by the current member of the Measures dimension. the result is Qtr1_Sales: @CONCATENATE(@CURRMBR(Year).A string or member name. for example.Hyperion Essbase Calc Scripts Miscellaneous Functions 14 @CONCATENATE The @CONCATENATE function returns a character string that is the result of appending one character string to another character string. @CONCATENATE("_". followed by an underscore. the result is Product100-10: @CONCATENATE("Product".A string or member name. 95 2. It treats strings as values or array of values.00 2.14 Miscellaneous Functions Hyperion Essbase Calc Scripts @NAME The @NAME() function passes the enclosed string or member name as a string to another function.05 Price = @J_GetPrice(@NAME(@CURRMBR(Product)).98 2. 14-12 Hyperion .05 Notes Essbase does not support strings in functions.98 1.95 2. Example The following example is based on the Sample Basic database. A user defined function is used to retrieving the price from the table below. or a string.95 1. The following report illustrates the above example: Jan 100-10 100-20 1.95 Feb 1. MonthName Jan Feb Mar Jan Feb Mar ProductId 100-10 100-10 100-10 100-20 100-20 100-20 Price 1.Any valid single member name.00 Mar 1. The user defined function (J_GetPrice) takes two string parameters time and product name to return the price for each product. Syntax @NAME (mbrName) mbrName .90 1.@NAME(@CURRMBR(Year))). dimension name. The @NAME function processes strings.90 1. StartPosition [.3. Example The following examples are based on the Sample Basic database: Statement @SUBSTRING ("100-10". 1 corresponds to the second character. EndPosition . EndPosition]) String .6) @SUBSTRING (@PARENT(Jan).The first position past the last character to be included in the substring. where 0 corresponds to the first character in String. and so on.2) @SUBSTRING ("200-21". or it can result from a specified function that returns a text string or a single member name. or a function that returns a string or a single member name StartPosition . Essbase returns all remaining characters from the source string. An integer greater than or equal to 0.3) Result "00-10" "20" “0-2” “1” (The parent of Jan is Qtr1. 1 corresponds to the second character. Syntax @SUBSTRING (String.Beginning character position within String to include in the substring. An integer greater than or equal to 0. and so on. If EndPosition is not specified or is less than StartPosition.A string or member name. The source string can be a text string or a member name.Hyperion Essbase Calc Scripts Miscellaneous Functions 14 @SUBSTRING The @SUBSTRING function returns the requested string of characters from an existing source string. where 0 corresponds to the first character in String.1) @SUBSTRING ("200-21".0.) Hyperion 14-13 . 14 Miscellaneous Functions Hyperion Essbase Calc Scripts 14-14 Hyperion . Tricks and Techniques Chapter Objectives By the end of this chapter. you will be able to: • Explore calc script options that improve efficiency and ensure accurate calculation results List data management tools used in calc scripts Describe the process of preparing for and creating calc scripts Determine whether IF or FIX is the most efficient way to isolate data in a calc script Illustrate how to use data management commands to prepare budget data Explain how to allocate high-level data to lower levels Demonstrate how to use cross-dimensional operators to perform market-share analysis • • • • • • .15 Tips. For example: Fix(Colas. calculate dense dimensions before sparse dimensions. blocks marked clean are not calculated.15 Tips. and IF tests every block. This minimizes the number of blocks processed on dense calculations. and does not cause the creation of additional sparse blocks. Keep in mind that order of calculation is determined by the outline unless you override that order. Because you could inadvertently create thousands of data blocks using this method. It also. IF or FIX As a general rule. a flag is set in the index node signifying that the block is clean. Calculating or aggregating on a sparse dimension exponentially increases the number of blocks. under many circumstances. Blocks on equations When you assign a constant to a member on a sparse dimension. FIX limits the number of blocks brought into memory. Two-pass calculations Use of two-pass calculations ensures correct calculation of higher level blocks.Actual) California = 120. Tricks and Techniques Hyperion Essbase Calc Scripts Calc Script Design Considerations As you create calc scripts. However. Intelligent Calcs Intelligent Calcs decrease the number of times a block is calculated. If a block has been recently calculated. and that some ways are more efficient than others. use the FIX command to ensure that Essbase creates only the required data blocks. use FIX instead of multiple IF statements on sparse blocks. Dense calculations before sparse calculations After a database has been loaded. Endfix 15-2 Hyperion . Essbase automatically creates a data block for every combination of sparse dimension members containing that member. increases the number of database passes. you find that there are many ways to create similar results. As additional calculations are performed. you may wish to experiment with various solutions in your environment to find the combination that works best for you.Misc. you can combine them and test for similar results. Communication As you develop a calc script. you should maintain contact with the analyst who requested it. should forecast sales for the same period be restated? Rollup considerations At what level in the outline do calculations occur? Is it necessary to roll up changes to higher levels? Is it necessary to push results down to lower levels? In addition to performing the basic calculations called for by the business problem. Ideally. Tricks and Techniques 15 Approaching Calc Scripts Solutions Although it is tempting to jump into coding a calc script by writing individual calculations. you may find it easier to break complex calculations into individual calculations for testing purposes. you may need to perform data management and rollup functions to ensure that the numbers work together. After you review the descriptionwhich should be clear and specific. Hyperion 15-3 . the less likely it is that you be required to redo your work. you save yourself time and unexpected results if you use the following method to develop calc scripts. Individual calculations As a general rule.Hyperion Essbase Calc Scripts Tips. Often requirements are ambiguous. and you do not discover problems until you are further along in the process. If actual sales increase by 10%. forecast data is dependent on actual sales data. However. The more contact you have with the analyst. calc scripts with fewer calculations run more efficiently. review the problem with the analyst who requested the calc script to make sure there are no ambiguities. For example. you receive a written description of the problem to be solved. Business problem The most important part of a calc script is the part that does not show up in the application: the business problem. When you are sure that the individual calculations work correctly. Affected data The two types of affected data are: data that is the subject of the calc script itself and data that is contextually dependent on the subject data. . FIX limits the number of blocks brought into memory.. In many situations. ENDIF Boolean functions and the likely corresponding Member Set functions are: Boolean Function @ISANCEST @ISCHILD @ISDESC @ISGEN @ISIANCEST @ISICHILD @ISIDESC @ISIPARENT @ISISIBLING @ISLEV @ISPARENT @ISSAMEGEN @ISSAMELEV @ISSIBLING @ISUDA Member Set Function @ANCESTORS @CHILDREN @DESCENDANTS @GENMBRS @IANCESTORS @ICHILDREN @IDESCENDANTS @IALLANCESTORS @ISIBLINGS @LEVMBRS @PARENT @GENMBRS @LEVMBRS @SIBLINGS @UDA As a general rule. use FIX instead of multiple IF statements on sparse blocks. and IF tests every block. Tricks and Techniques Hyperion Essbase Calc Scripts IF vs FIX One consideration for isolating data is the choice between IF and FIX..15 Tips. for example: FIX(“New York”) . 15-4 Hyperion .. However. ENDFIX is often equivalent to: IF(@ISMBR(”New York”)) . you may wish to experiment with various solutions in your environment to find the combination that works best for you. either structure could be used by using a Boolean function in a IF-structure or its corresponding Member Set function in the FIX-structure. Although IF and FIX provide the same results. Individual calculations Data for commissions should be copied from 1999 actuals to the 2000 budget. The 2000 budget is derived from unadjusted commissions for 1999 actuals. Then actual commissions should be increased for the Eastern region by 25%. Tricks and Techniques 15 Exercise 15-1: Isolating Data Using IF or FIX In the scenario. You must derive 2000 budget data for commissions. not the increased commissions.xls 1) 2) 3) Open and review the data in spreadsheet SS_If_Fix. Business problem Make commission adjustments for the Eastern region. increasing all commissions for the 1999 actuals by 25%. Notice which members are affected and whether the dimensions containing those members are dense or sparse. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSIf_Fix SS_If_Fix. Rollup considerations There are no rollup considerations. clear all data from the HLandS2 database.xls. you must perform two calculations for the Eastern region. Review the outline for the HLandS2 database. For this exercise. Affected data All 1999 actual data for commissions in the Eastern region is affected. you need to consider density and efficiency when you choose the appropriate command. Hyperion 15-5 . because data is at the lowest level. The budgeted amount should reflect the original commissions for the current year. From Essbase Application Manager.Hyperion Essbase Calc Scripts Tips. In Microsoft Excel. consider whether to use IF or FIX on the specific data that you are calculating. From the Calc&Retrieve sheet.15 Tips. The retrieval may take a few minutes. run the CSIF_Fix calc script. Perform a retrieval and notice the calculation results. Tricks and Techniques 4) Hyperion Essbase Calc Scripts Create a calc script using the Calc Script Editor. Lock and send the data in the Lock&Send sheet to the HLandS2 database. If all calculation requirements are not met. revise the calc script and rerun the calculation. Ensure that all calculation requirements are met. connect to the Essbase server and select the Calc:HLandS2 database. When writing the calc script. 5) 6) 7) 8) 9) 15-6 Hyperion . Save the calc script as CSIF_Fix. Close the SS_If_Fix spreadsheet. From Essbase Application Manager. run the CSIfix2 calc script. Which is more efficient for your environment? 4) 5) 6) 7) 8) 9) 10) Hyperion 15-7 . and connect to the Essbase server and select the Calc:HLandS2 database. Perform a retrieval and notice the calculation results. review the event log to determine the length of time required to run the calc script CSIfix2. Save the calc script as CSIfix2.xls 1) 2) 3) From Essbase Application Manager. From the Calc&Retrieve sheet. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS2 CSIf_Fix CSIfix2 SS_If_Fix. The retrieval may take a few minutes. Close the SS_If_Fix spreadsheet. review the event log to determine the length of time required to run the calc script CSIf_Fix. and the FIX statements with equivalent IF statements. Replace IF statements with equivalent FIX statements. redo the calc script for Exercise 15-1. and the FIX statements with equivalent IF statements. but replace IF statements with equivalent FIX statements. Tricks and Techniques 15 Exercise 15-1b: Isolating Data Using IF or FIX Time permitting.xls. Lock and send the data in the Lock&Send sheet to the HLandS2 database. Modify the calc script CSIf_Fix using the Calc Script Editor. Ensure that all calculation requirements are met. For this exercise. If all calculation requirements are not met. In Microsoft Excel open spreadsheet SS_If_Fix. revise the calc script and rerun the calculation. Clear all data from the HLandS2 database.Hyperion Essbase Calc Scripts Tips. They usually consume large amounts of resources. Since Profit is calculated by deducting the freight charge from Margin. @CHILDREN (West). Therefore. Where possible. Looping The need to use loops is very rare.05. A couple of examples follow. the new policy is to charge a rate for freight of 1. and should be avoided. or record keeping. @CHILDREN ("Total Expenses")..@CHILDREN ("Total Expenses")) "2000 Budget"= "1999 Actual"*1.15 Tips. both Freight and Profit are now unknown values in a simultaneous equation. However Freight is currently only charged as the cost of shipping. and does not account for shipping materials.share). in tests with a small database. solve simultaneous equations algebraically instead of using loops. These costs include Freight which is loaded directly into the database at level 0.COGS .05. For example: At present Profit is calculated by consolidation operators within the outline as Margin less various costs."1999 Actual". the second example ran 10% faster. the department overhead. ENDFIX But. it is often more efficient to use cross-dimensional operators instead of the @MDALLOCATE function. Allocation vs Cross-Dimensional Operators When looking at the allocation of values from upper-level members to lower-level members. Often the simplest solution is the most efficient. To cover all the expenses associated with shipping.5% of Profit. Tricks and Techniques Hyperion Essbase Calc Scripts Simpler is Usually Better Use the power of the OLAP structure to help create the simplest solution to your problem. ENDFIX produces the same results as: FIX (@CHILDREN (West).{Other Expenses} . 2. For example: FIX ("Total Expenses") "2000 Budget"= @MDALLOCATE (West->"1999 Actual"->"Total Expenses"* 1. Profit= Sales .Freight 15-8 Hyperion . Hyperion Essbase Calc Scripts and Freight = . But. LOOP(10.{other expenses})/1.015 * Profit.015.015.001) Break = 1. in tests with a small database. ENDIF) ENDLOOP which produces the same results as: Profit = (Sales . Freight = Profit * .015*(Sales .COGS . Hyperion 15-9 . Algebraic manipulation yields: Tips. Break) Profit = Sales . Profit( IF (Profit<>#Missing AND @ABS((.015.Freight))-Freight) < 0.COGS .Freight. Two options for creating this calc script are: VAR Break = 0.015. Tricks and Techniques 15 Profit = (Sales . Freight = Profit * .COGS .COGS) / 1. the second example ran over 90% faster. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSAlloc2 SS_Alloc2. Individual calculations Calculation of lower level freight costs is based on a ratio of actual individual freight to actual total freight. freight costs must be allocated to each sale.Market combination for budgeted freight is calculated based on this ratio. Product and Market data must be rolled up to the highest level. For example.xls 15-10 Hyperion . total freight can be stored at an ancestor level. Rollup considerations To obtain accurate data for total Freight expense. Use cross-dimensional operators to define the formula. and must be allocated down to the individual Product-Market level. Budgeted freight expense is loaded at the highest level. rather than at the individual transaction level. Business problem Calculate a line item for freight for each individual Product-Market combination.15 Tips. Solution Write a calc script to calculate the freight expense for each Product-Market combination. The Freight data is allocated to each combination of Product and Market. Tricks and Techniques Hyperion Essbase Calc Scripts Exercise 15-2: Allocations Data can be loaded into high-level members of an Essbase database. To show the true profit on a sale. For this exercise. Affected data Data from total budgeted freight that is loaded is used to provide an individual budgeted freight expense. For each Product-Market develop a ratio of actual sales to total sales. The allocation is based on the ratio of an individual sale to total sales. Each Product. Apply each ratio to the total freight costs to provide individual freight costs. 2) 3) 4) 5) 6) 7) 8) 9) 10) Hyperion 15-11 . If not. connect to the Essbase server and select the CALC:HLandS1 database. Perform a retrieval and notice the calculation results. From Essbase Application Manager. In Microsoft Excel.xls. clear all data from the HLandS1 database. Lock and send the data in the Lock&Send sheet to the HLandS1 database. Create your calc script using the Calc Script Editor. review the event log to determine the length of time required to run the calc script CSAlloc2. Note which data is affected and determine whether rollups must be completed before individual calculations. From Essbase Application Manager. Tricks and Techniques 15 Review the outline for the HLandS1 database. The retrieval may take a few minutes.Hyperion Essbase Calc Scripts 1) Tips. Ensure that all calculation requirements are met. revise the calc script and rerun the calculation. Open and review the data in spreadsheet SS_Alloc2. Save your calc script as CSAlloc2. run the CSAlloc2 calc script. Close the SS_Alloc2 spreadsheet. From the Calc&Retrieve sheet. Rollup considerations Because the calculation of the Products share is based upon total Products sales. Business problem Management is concerned with how well Rods & Reels are selling. These are within the Actual scenario.xls 1) Review the data in spreadsheet SS_Share. Solution Write a calc script that calculates Product Share. you use the following files: Database Calc Script (new) Spreadsheet CALC:HLandS1 CSShare SS_Share. Areas of the data must be isolated: sales data for individual products and sales data for total products. For this exercise. Tricks and Techniques Hyperion Essbase Calc Scripts Exercise 15-3: Product Share Analysis Almost every business wants to know what products are its best sellers. Individual calculations Individual calculations consist of calculating a percentage of individual Rods & Reels sales by total Product sales. Calculate percentage of Rods & Reels sales to total product sales. 15-12 Hyperion . sales must be rolled up across the entire database for actuals. Product Share is equal to a product or sales of a product line as a percentage of total product sales. The Sales member of the dimension tagged as accounts in also affected. Use cross-dimensional operators to define the formula.15 Tips. both on a category level (all Rods & Reels) and on an individual product level. Affected data Total Products sales and the Rods and Reels member of the Products dimension's are affected or referenced by these calculations. Create a calc script using the Calc Script Editor. Connect to the Essbase server and select the CALC:HLandS1 database. In Microsoft Excel. Perform a retrieval and compare the retrieved calculation results to the results in the “Expected Results” column. Do the calculated results match the expected results? If not. From Essbase Application Manager. From Essbase Application Manager. clear all data from the HLandS1 database. open and review the data in spreadsheet SS_Share. 3) 4) 5) 6) 7) 8) 9) 10) 11) Hyperion 15-13 . Notice which data is affected. clear all data from the HLandS1 database. and determine whether rollups must be completed before individual calculations.xls. From the Calc&Retrieve sheet. Tricks and Techniques 15 Open the outline for the HLandS1 database.Hyperion Essbase Calc Scripts 2) Tips. Lock and send the data in the Lock&Send sheet to the HLandS1 database. run the CSShare calc script. revise the calc script and rerun the calculation. Save the calc script as CSShare. Close the SS_Share spreadsheet. you had the opportunity to review business problems and develop calc scripts to solve the problems. Tricks and Techniques Hyperion Essbase Calc Scripts Unit Summary In previous units. you looked at functions and commands in isolation or in small calc scripts that provided context. Hyperion .15 Tips. budget creation. Careful planning and an understanding of the business problem are key to creating successful calc scripts. In this unit. and market share analysis) to solve common business problems. The basic steps used to create calc scripts are as follows: Clarify the business problem Identify affected data Satisfy rollups requirements Create individual calculations 15-14 H H H H You created calc scripts (allocations. In some cases. more than one solution is presented. It is left up to you to test these solutions to determine which is the most efficient for your particular environment. .A Suggested Answers Possible Solutions • • Potential solutions to the exercises for the course are presented in this chapter. Variance = @VAR (Actual. Budget). “Total Expenses”. “Regional Profit”. ) A-2 Hyperion . ENDIF ) Exercise 4-3: Focus Calculations using Cross-Dimensional Operators Sales ( Budget->"Feb 1999"->Sales= Budget->"Jan 1999"->Sales*1.08. “Pre Tax Profit”. Commission ( IF ("Margin Percent" > 15) Commission = Sales * . ENDFIX Exercise 4-2: Focus Calculations using If / Else / Endif CALC DIM (Accounts). Exercise 3-3: Member Calculations and Mathematical Operators “Margin”.15. CALC DIM (Accounts). ELSE Commission = Sales * . Exercise 3-2: Running Calc Scripts SET MSG SUMMARY. Exercise 4-1: Focus Calculations using Fix / EndFix FIX (Budget.A Suggested Answers Hyperion Essbase Calc Scripts Exercise 3-1: Explore Calc Script Editor and Online Help CALC DIM (Accounts).1.10. "Jan 1999") Sales = Sales * 1. Budget). Budget). Variance = @VAR(Actual. "Albany". Variance = @VAR (Actual. "Buffalo". 2. ENDIF. Products). Actual) FIX (Sales) Connecticut= @ROUND(@AVG(SKIPNONE. Sales).15.1. ELSE Sales = Actual->"1999"*. Budget) Sales( IF (@ISDESC (East) OR @ISDESC (West) ) Sales = Actual->"1999"*1. ENDFIX ENDFIX Exercise 6-1: Using Boolean Functions FIX (Products. Accounts. ELSEIF (@ISDESC (South)) Sales = Actual->"1999"*1.95. ENDFIX Exercise 7-1: Applying Member Set Functions FIX (Budget) FIX(@IDESCENDANTS (East)) CALC DIM (Time.2). Markets. Products)."Corporate Expenses") * Sales/@ANCESTVAL (Products.Hyperion Essbase Calc Scripts Suggested Answers A Exercise 5-1: Use Math Functions FIX ("Jan 1999". "2000". ENDFIX Hyperion A-3 . ENDFIX "Corporate Expenses"= @ANCESTVAL (Products. 2.Bridgeport:Waterbury). ENDFIX @IDESCENDANTS (East). ENDFIX Exercise 8-1: Applying Relationship Function (@ANCESTVAL) FIX (Budget) FIX (Sales) CALC DIM (Time. "4000 Product Family") Cash( IF (NOT(@ISMBR ("1997 Actual"))) Cash = Profit. FIX(@IDESCENDANTS(Markets.0)) COGS COGS=Sales*(@XREF (COGS. ELSE "Opening Inventory" = @PRIOR("Ending Inventory")."1998 Actual".Additions.-1)) "Average Inventory" = @AVGRANGE (SKIPMISSING. "1011-0010". @LVLMBRS(Products. "1997 Actual". Additions="Ending Inventory" . COGS)). ENDFIX Exercise 9-1: Applying Range Functions (@PRIOR) FIX ("1999 Actual") "Opening Inventory" ( IF (@ISMBR (Jan)) "Opening Inventory"="Ending Inventory" . "Ending Inventory". "2000 Actual") CALC DIM(Markets). ENDFIX A-4 Hyperion . ENDFIX ENDFIX Exercise 8-3: Applying Relationship Function (@XREF) FIX (Actual) COGS (IF (@ISLEV (Products. @CHILDREN (@CURRMBR (Markets))). ENDIF ) ENDFIX Exercise 9-2: Applying Financial Functions (@IRR) FIX("Total Year". ENDIF) ENDFIX OR FIX (Actual."Opening Inventory". Markets. COGS)).A Suggested Answers Hyperion Essbase Calc Scripts Exercise 8-2: Applying Relationship Function (@CHILDREN) FIX (Jan. 1. ENDIF ) ROI=@IRR (Cash."2000 Actual"). "1999 Actual". 0)) COGS=Sales*(@XREF (COGS. share). Markets). "Sales Rank"( FIX (@LEVMBRS (Markets."1011-0000-1") CALC DIM(Markets). Markets. ENDFIX Exercise 11-1: Applying Forecasting Functions FIX ("1011-0000-1". Sales. "Total Year". "2000 Budget"->"Total Year"->Sales. @RANGE (Sales.1))).. ENDFIX ENDFIX Hyperion A-5 ."1999 Actual". @LEVMBRS (Markets.) ENDFIX Exercise 12-1: Applying Statistical Functions FIX("1999 Actual".05. Markets). @LEVMBRS (Markets.. "1999 Actual"->"Total Year").1)) "Sales Rank"=@RANK (SKIPMISSING. ENDFIX FIX ("2000 Budget") CALC DIM (Accounts. 2. "1998 Actual"->"Total Year"->Sales. Jan.Hyperion Essbase Calc Scripts Suggested Answers A Exercise 10-1: Applying Allocation Functions FIX ("1999 Actual") CALC DIM (Accounts... @CHILDREN ("Total Expenses"). @CHILDREN (West).. LR). ENDFIX FIX ("Total Expenses") "2000 Budget"= @MDALLOCATE (West->"1999 Actual"->"Total Expenses" * 1. 2)) Sales ( @TREND (@LIST("1997 Actual"->"Total Year"->Sales. A Suggested Answers Hyperion Essbase Calc Scripts Exercise 13-1: Applying the Date & Time Function FIX(Dec. ENDIF) ENDFIX OR FIX ("2000 Budget") Commission ( IF (@ISIDESC (East)) Commission=Commission->"1999 Actual". ELSEIF (@ATTRIBUTEVAL ("IntroDate")<= @TODATE ("mm-dd-yyyy". ELSE Marketing = "1999 Actual"->Marketing.25.1. ENDIF) ENDFIX FIX ("1999 Actual") Commission ( IF (@ISIDESC (East)) Commission=Commission*1. FIX("2000 Budget" ) Marketing( IF (@ATTRIBUTEVAL ("IntroDate")>= @TODATE ("mm-dd-yyyy".25. "07-05-1996")) Marketing = "1999 Actual"->Marketing * . ENDIF ) ENDFIX ENDFIX Exercise 15-1 & 15-1b: Isolating Data Using IF or FIX FIX (@IDESCENDANTS (East)) Commission ( IF (@ISMBR ("2000 Budget")) Commission=Commission->"1999 Actual". ENDIF) ENDFIX A-6 Hyperion . ENDIF) Commission ( IF (@ISMBR ("1999 Actual")) Commission=Commission*1.9. "01-01-1997")) Marketing = "1999 Actual"->Marketing * 1. "New York") CALC DIM(Products). ENDFIX OR FIX (Actual. ENDFIX ENDFIX Hyperion A-7 . ENDFIX FIX (@IDESCENDANTS("2000 Product Family")) "Product Share"=Sales%Sales->Products. ) ENDFIX Exercise 15-2 : Allocations FIX (Actual. @LEVMBRS(Markets.Sales) CALC DIM (Time. "1999 Actual"->Commission= Commission->"1999 Actual"*1. ENDIF) OR FIX (@IDESCENDANTS (East)) Commission ( "2000 Budget"->Commission=Commission->"1999 Actual". Products). 0)) Freight=Sales->Actual / Sales->Actual->Markets->Products * Freight->Products->Markets.Hyperion Essbase Calc Scripts OR - Suggested Answers A Commission ( IF (@ISIDESC (East)) "2000 Budget"->Commission=Commission->"1999 Actual". Markets. Markets. "1999 Actual"->Commission= Commission->"1999 Actual"*1. ENDFIX FIX (Budget.25. Products). ENDFIX Exercise 15-3 : Product Share Analysis FIX (Actual) FIX (Sales) CALC DIM (Time. ENDFIX FIX (Budget) Freight=Sales->Actual / Sales->Actual->Markets->Products * Freight->Products->Markets.25.Sales) CALC DIM (Time. Markets. @LEVMBRS(Products. 0). Products). A Suggested Answers Hyperion Essbase Calc Scripts A-8 Hyperion . B Essbase Outlines The outlines used in for examples and exercises are detailed in this section.Basic Calc . They include • • • • Sample .COGS .HLandS2 Calc .HLandS1 Calc . Basic The Sample .B Essbase Outlines Hyperion Essbase Calc Scripts Sample .Basic outline is used to illustrate many of the examples in the descriptive material: Year (Dense) Qtr1 Jan Feb Mar Qtr2 Apr May Jun Qtr3 Jul Aug Sep Qtr4 Oct Nov Dec Measures (Dense) Profit Margin Sales COGS Total Expenses Marketing Payroll Misc Inventory Opening Inventory Additions Ending Inventory Ratios Margin % Profit % Profit per Ounce Product (Sparse) 100 Alias: Colas 100-10 100-20 100-30 Alias: Root Beer 200-10 200-20 200-30 200-40 Alias: Cream Soda 300-10 300-20 300-30 Alias: Fruit Soda 400-10 400-20 400-30 Alias: Diet Drinks 100-20 Shared 200-20 Shared 300-30 Shared 200 300 400 Diet B-2 Hyperion . Basic (Continued) Market (Sparse) East New York Massachusetts Florida Connecticut New Hampshire West California Oregon Washington Utah Nevada South Texas Oklahoma Louisiana New Mexico Central Illinois Ohio Wisconsin Missouri Iowa Colorado Scenario (Dense) Actual Budget Variance Variance % Hyperion B-3 .Hyperion Essbase Calc Scripts Essbase Outlines B Sample . B Essbase Outlines Hyperion Essbase Calc Scripts Sample - Basic (Attribute Dimensions) Caffeinated (Attribute of Product) TRUE FALSE Ounces (Attribute of Product) 32 20 16 12 Pkg Type (Attribute of Product) Bottle Can Population (Attribute of Market) Small 3000000 6000000 Medium 9000000 12000000 15000000 18000000 Large 21000000 24000000 27000000 30000000 33000000 Intro Date (Attribute of Product) 3/25/96 4/1/96 9/27/95 7/26/96 12/10/96 6/26/96 10/1/96 B-4 Hyperion Hyperion Essbase Calc Scripts Essbase Outlines B Calc - HLandS1 The HLandS1 database is used for many of the exercises. The major differences from HLandS2 are in the structure of the Time and Scenarios dimensions. The Markets and Products dimensions are identical in each of these outlines.l Time (Dense) 1997 Qtr1 1997 Jan-97 Feb-97 Mar-97 Qtr2 1997 Apr-97 May-97 Jun-97 Qtr3 1997 Jul-97 Aug-97 Sep-97 Qtr4 1997 Oct-97 Nov-97 Dec-97 1998 Qtr1 1998 Jan-98 Feb-98 Mar-98 Qtr2 1998 Apr-98 May-98 Jun-98 Qtr3 1998 Jul-98 Aug-98 Sep-98 Qtr4 1998 Oct-98 Nov-98 Dec-98 1999 Qtr1 1999 Jan-99 Feb-99 Mar-99 Qtr2 1999 Apr-99 May-99 Jun-99 Qtr3 1999 Jul-99 Aug-99 Sep-99 Qtr4 1999 Oct-99 Nov-99 Dec-99 2000 Qtr1 2000 Jan-00 Hyperion B-5 B Essbase Outlines Feb-00 Mar-00 Qtr2 2000 Apr-00 May-00 Jun-00 Qtr3 2000 Jul-00 Aug-00 Sep-00 Qtr4 2000 Oct-00 Nov-00 Dec-00 Hyperion Essbase Calc Scripts Accounts (Dense) Profit Pre Tax Profit Regional Profit Margin Sales COGS Total Expenses Freight Administration Payroll Marketing Miscellaneous Corporate Expenses Tax Inventory Opening Inventory Additions Ending Inventory Ratios Margin Percent Profit Percent Product Share Statistics Average Sales Commission Days of Sales Available Days Of Sales Adjusted Store Count Average Margin B-6 Hyperion Hyperion Essbase Calc Scripts Essbase Outlines B CALC - HLandS1 (Continued) Scenario (Dense) Actual Budget Variance Variance Percent Percent Markets (Sparse) East Connecticut Bridgeport Hartford Stamford Waterbury Maine Augusta Bangor Millinocket Portland Massachuset ts New Bedford Springfield Worcester New York Albany Buffalo Ithaca White Plains Rhode Island Jamestown Providence Quonochontaug West California Bakersfield Foster City Sacramento Half Moon Bay New Mexico Albuquerque Deming Sante Fe Oregon Condon Eugene Salem Washington Olympia Spokane Tacoma Walla Walla South Alabama Andalusia Birmingham Mobile Hyperion B-7 B Essbase Outlines Montgomery Florida Orlando Sarasota Tampa Georgia Athens Macon Valdosta Tennessee Memphis Murfreesboro Nashville Central Illinois Antioch Carbondale Cobden Rockford Wisconsin Green Bay La Crosse Milwaukee Neenah Wausau Texas Amarillo Austin Dallas Waco Missouri Hyperion Essbase Calc Scripts Cape Girardeau Kansas City Lebanon Sikeston St. Louis B-8 Hyperion Hyperion Essbase Calc Scripts Essbase Outlines B CALC - HLandS1 (Continued) Products 1000 Product Family Crazy Horse 1011 1011-0000 1011-0000-1 1011-0000-2 1011-0000-3 1011-0010 1011-0020 1011-0030 1011-0040 Crazy Horse 1021 1021-0000 1021-0010 1021-0020 1021-0020-1 1021-0020-2 1021-0020-3 Crazy Horse 1031 1031-0000 1031-0020 1031-0030 1031-0040 1031-0050 1031-0050-1 1031-0050-2 1031-0050-3 1031-0070 1031-0070-1 1031-0070-2 1031-0090 Crazy Horse 1041 1041-0000 1041-0020 1041-0040 1041-0060 1041-0070 1041-0090 2000 Product Family Old Faithful 2011 2011-0000 2011-0000-1 2011-0000-2 2011-0000-3 2011-0000-4 2011-0000-5 2011-0000-6 2011-0010 2011-0010-1 2011-0010-2 2011-0010-3 2011-0010-4 2011-0010-5 2011-0010-6 Old Faithful 2021 2021-0000 2021-0010 Old Faithful 2031 2031-0000 2031-0000-1 2031-0000-2 Hyperion B-9 B Essbase Outlines Hyperion Essbase Calc Scripts 2031-0000-3 2031-0000-4 2031-0000-5 2031-0000-6 2031-0010 2031-0010-1 2031-0010-2 2031-0010-3 2031-0010-4 2031-0010-5 2031-0010-6 Old Faithful 2041 2041-0000 2041-0020 3000 Product Family Pomona 3011 3011-0000 3011-0010 3011-0020 3011-0030 3011-0040 Pomona 3021 3021-0000 3021-0010 3021-0030 Pomona 3031 3031-0000 3031-0030 3031-0020 3031-0040 Pomona 3041 3041-0000 3041-0020 3041-0040 3041-0060 Pomona 3051 3051-0000 3051-0000-1 3051-0000-2 3051-0000-3 3051-0000-4 3051-0020 3051-0020-1 3051-0020-2 4000 Product Family Shawnee 4011 4011-0000 4011-0010 4011-0020 Shawnee 4021 4021-0000 4021-0000-1 4021-0000-2 4021-0010 4021-0010-1 4021-0010-2 Shawnee 4031 4031-0000 4031-0000-1 4031-0000-2 4031-0010 4031-0010-1 4031-0010-2 B-10 Hyperion Hyperion Essbase Calc Scripts Essbase Outlines B Calc - HLandS2 The HLandS2 database is used for many of the exercises. The major differences from HLandS1 are in the structure of the Time and Scenarios dimensions. The Markets and Products dimensions are identical in each of these outlines. Total Year Qtr1 Jan Feb Mar Qtr2 Apr May Jun Qtr3 Jul Aug Sep Qtr4 Oct Nov Dec Accounts Profit Pre Tax Profit Regional Profit Margin Sales COGS Total Expenses Freight Administration Payroll Marketing Miscellaneous Corporate Expenses Tax Inventory Opening Inventory Additions Ending Inventory Average Inventory Ratios Margin Percent Profit Percent Product Share Statistics Average Sales Commission Days of Sales Available Days Of Sales Adjusted Store Count Sales Rank Average Margin Cash ROI Hyperion B-11 HLandS2 (Continued) Scenario 1997 1997 Actual 1998 1998 Actual 1998 Budget 1999 1999 Actual 1999 Budget 2000 2000 Actual 2000 Budget Variances 1998 Actual VS 1999 Actual Percent Variance 1998 Budget VS 1999 Budget 1998 Actual VS 1998 Budget Markets (Sparse) East Connecticut Bridgeport Hartford Stamford Waterbury Maine Augusta Bangor Millinocket Portland Massachuset ts New Bedford Springfield Worcester New York Albany Buffalo Ithaca White Plains Rhode Island Jamestown Providence Quonochontaug West California Bakersfield Foster City Sacramento Half Moon Bay New Mexico Albuquerque Deming Sante Fe Oregon Condon Eugene Salem Washington Olympia B-12 Hyperion .B Essbase Outlines Hyperion Essbase Calc Scripts CALC . Hyperion Essbase Calc Scripts Spokane Tacoma Walla Walla South Alabama Andalusia Birmingham Mobile Montgomery Florida Orlando Sarasota Tampa Georgia Athens Macon Valdosta Tennessee Memphis Murfreesboro Nashville Central Illinois Antioch Carbondale Cobden Rockford Wisconsin Green Bay La Crosse Milwaukee Neenah Wausau Texas Amarillo Austin Dallas Waco Missouri Cape Girardeau Kansas City Lebanon Sikeston St. Louis Essbase Outlines B Hyperion B-13 . HLandS2 (Continued) Products 1000 Product Family Crazy Horse 1011 1011-0000 1011-0000-1 1011-0000-2 1011-0000-3 1011-0010 1011-0020 1011-0030 1011-0040 Crazy Horse 1021 1021-0000 1021-0010 1021-0020 1021-0020-1 1021-0020-2 1021-0020-3 Crazy Horse 1031 1031-0000 1031-0020 1031-0030 1031-0040 1031-0050 1031-0050-1 1031-0050-2 1031-0050-3 1031-0070 1031-0070-1 1031-0070-2 1031-0090 Crazy Horse 1041 1041-0000 1041-0020 1041-0040 1041-0060 1041-0070 1041-0090 2000 Product Family Old Faithful 2011 2011-0000 2011-0000-1 2011-0000-2 2011-0000-3 2011-0000-4 2011-0000-5 2011-0000-6 2011-0010 2011-0010-1 2011-0010-2 2011-0010-3 2011-0010-4 2011-0010-5 2011-0010-6 Old Faithful 2021 2021-0000 2021-0010 Old Faithful 2031 2031-0000 2031-0000-1 2031-0000-2 B-14 Hyperion .B Essbase Outlines Hyperion Essbase Calc Scripts CALC . Hyperion Essbase Calc Scripts Essbase Outlines 2031-0000-3 2031-0000-4 2031-0000-5 2031-0000-6 2031-0010 2031-0010-1 2031-0010-2 2031-0010-3 2031-0010-4 2031-0010-5 2031-0010-6 B Old Faithful 2041 2041-0000 2041-0020 3000 Product Family Pomona 3011 3011-0000 3011-0010 3011-0020 3011-0030 3011-0040 Pomona 3021 3021-0000 3021-0010 3021-0030 Pomona 3031 3031-0000 3031-0030 3031-0020 3031-0040 Pomona 3041 3041-0000 3041-0020 3041-0040 3041-0060 Pomona 3051 3051-0000 3051-0000-1 3051-0000-2 3051-0000-3 3051-0000-4 3051-0020 3051-0020-1 3051-0020-2 4000 Product Family Shawnee 4011 4011-0000 4011-0010 4011-0020 Shawnee 4021 4021-0000 4021-0000-1 4021-0000-2 4021-0010 4021-0010-1 4021-0010-2 Shawnee 4031 4031-0000 4031-0000-1 4031-0000-2 4031-0010 4031-0010-1 4031-0010-2 Hyperion B-15 . B Essbase Outlines Hyperion Essbase Calc Scripts CALC .HLandS2 (Attribute Dimension) IntroDate 1/1/90 7/5/96 7/6/96 10/13/98 B-16 Hyperion . Hyperion Essbase Calc Scripts Essbase Outlines B Calc .COGS Time (Dense) 1997 1998 1999 2000 Accounts COGS Hyperion B-17 . B Essbase Outlines Hyperion Essbase Calc Scripts Calc .COGS (Continued) Products 1000 Product Family Crazy Horse 1011 1011-0000 1011-0000-1 1011-0000-2 1011-0000-3 1011-0010 1011-0020 1011-0030 1011-0040 Crazy Horse 1021 1021-0000 1021-0010 1021-0020 1021-0020-1 1021-0020-2 1021-0020-3 Crazy Horse 1031 1031-0000 1031-0020 1031-0030 1031-0040 1031-0050 1031-0050-1 1031-0050-2 1031-0050-3 1031-0070 1031-0070-1 1031-0070-2 1031-0090 Crazy Horse 1041 1041-0000 1041-0020 1041-0040 1041-0060 1041-0070 1041-0090 2000 Product Family Old Faithful 2011 2011-0000 2011-0000-1 2011-0000-2 2011-0000-3 2011-0000-4 2011-0000-5 2011-0000-6 2011-0010 2011-0010-1 2011-0010-2 2011-0010-3 2011-0010-4 2011-0010-5 2011-0010-6 Old Faithful 2021 2021-0000 2021-0010 Old Faithful 2031 2031-0000 2031-0000-1 2031-0000-2 B-18 Hyperion . Hyperion Essbase Calc Scripts Essbase Outlines 2031-0000-3 2031-0000-4 2031-0000-5 2031-0000-6 2031-0010 2031-0010-1 2031-0010-2 2031-0010-3 2031-0010-4 2031-0010-5 2031-0010-6 B Old Faithful 2041 2041-0000 2041-0020 3000 Product Family Pomona 3011 3011-0000 3011-0010 3011-0020 3011-0030 3011-0040 Pomona 3021 3021-0000 3021-0010 3021-0030 Pomona 3031 3031-0000 3031-0030 3031-0020 3031-0040 Pomona 3041 3041-0000 3041-0020 3041-0040 3041-0060 Pomona 3051 3051-0000 3051-0000-1 3051-0000-2 3051-0000-3 3051-0000-4 3051-0020 3051-0020-1 3051-0020-2 4000 Product Family Shawnee 4011 4011-0000 4011-0010 4011-0020 Shawnee 4021 4021-0000 4021-0000-1 4021-0000-2 4021-0010 4021-0010-1 4021-0010-2 Shawnee 4031 4031-0000 4031-0000-1 4031-0000-2 4031-0010 4031-0010-1 4031-0010-2 Hyperion B-19 . B Essbase Outlines Hyperion Essbase Calc Scripts B-20 Hyperion .
Copyright © 2024 DOKUMEN.SITE Inc.