230 likes | 383 Views
UNIT 4 Calculation Script Architecture – Advanced Functions. Topics. Range functions Relationship functions Iterative processing Simultaneous equations Environmental settings Variables. Exploring Advanced Functions and Commands. Range functions Relationship functions Iterative commands
E N D
Topics • Range functions • Relationship functions • Iterative processing • Simultaneous equations • Environmental settings • Variables
Exploring Advanced Functions and Commands • Range functions • Relationship functions • Iterative commands • Environmental commands
Mathematical @SUMRANGE @AVGRANGE @MAXRANGE @MINRANGE Exceptions @CURRMBRRANGE @PRIOR Financial @SLN @IRR @COMPOUND Calculating Values Using Range Functions
Calculating Values Using @SUMRANGE Sums values of a specified member across a range Example: Q1_SALES = @SUMRANGE(SALES, JAN : MAR) ; Result: Q1_SALES = 600 Sales: Jan: 100 Feb: 200 Mar: 300
Calculating Values Using @AVGRANGE Averages values of a specified member across a range Example: Q1_AVGSALES = @AVGRANGE(SKIPMISSING,SALES, JAN : MAR) ; Result: Q1_AVGSALES = 200 Sales: Jan: 100 Feb: #MI Mar: 300
Calculating Values Using @MINRANGE and @MAXRANGE Supplies minimum or maximum value of a member across a range Examples: Q1_MIN = @MINRANGE(SALES, JAN : MAR) ; Q1_MAX= @MAXRANGE(SALES, JAN : MAR) ; Results: Q1_MIN = 100 Q1_MAX = 300 Sales: Jan: 100 Feb: 200 Mar: 300
Calculating Values Using @CURRMBRRANGE • Returns a member list based on the relative position of the member being calculated • Can be used only with range functions Example: Six_Month_Total = @SUMRANGE (Sales, @CURRMBRRANGE(Year, LEV, 0,-5 , 0)) /"Average Inventory” ;
Calculating Values Using @PRIOR Returns the value from the previous or the nth previous member in a range of members By default uses the lowest level of a dimension tagged as Time Example: Inventory = @PRIOR(End_Inv) ; Result: Jan Feb Mar Apr May Jun Inventory 1100 1100 1200 1000 1300 1300 End_Inv 1100 1200 1000 1300 1300
Obtaining Values Using Relationship Functions • @PARENTVAL • @ANCESTVAL • @MDPARENTVAL
Obtaining Values Using @PARENTVAL Returns the immediate parent value of a specified member combination Example: PRODUCT_MIX=SALES % @PARENTVAL(PRODUCT,SALES); Result: PRODUCT_MIX is calculated for New York PRODUCT_MIX = 50% Given EAST = 100,000, New York = 50,000,
Obtaining Values Using @ANCESTVAL Returns a higher level value of a specified member combination based on specified generation or level Example: PRODUCT_MIX=SALES % (@ANCESTVAL(PRODUCT,2,SALES)); Result:PRODUCT_MIX = 10 % Given Colas (Gen 2) = 100,000, Diet Cola (Gen 3) = 50,000, Kool Kola (Gen 4) = 10,000
Obtaining Values Using @MDANCESTVAL • A higher level value of a specified member combination, based on position specified across multiple dimensions • References any dimension and any generations • Marketing = (Sales / @MDANCESTVAL(2, Market, 2, Product, 2, Sales)) * @MDANCESTVAL(2, Market, 2, Product, 2, Marketing);
FIX(New_York,Camera,Actual,Mar) LOOP(30) Commission = Profit * .15; Profit=Margin-Total_Expenses-Commission; ENDLOOP ENDFIX Controlling Execution Using Loop…Endloop Use the LOOP...ENDLOOP command to specify the number of times to iterate a group of calculations. Syntax:
Explaining Simultaneous Equations • Unknown values exist on either side of the equal sign. • A = B * .15, where A and B are unknown. • B = y - A, where y is data and A and B are unknown.
Exercise 4-3:Using Loop…Endloop to Solve Simultaneous Equations
Setting the Calculator Environment • SET commands • Enhance log information • Determine Intelligent Calculation behavior • Manage memory • Variable declarations • Scalar • Arrays • Substitution variables
Using Set Commands to Set the Calculator Environment • Information SET MSG SET NOTICE • Intelligent Calculation SET UPDATECALC SET CLEARUPDATESTATUS • Optimization SET AGGMISSG SET CACHE SET LOCKBLOCK SET FRMLBOTTOMUP SET CALCHASHTBL • Set commands are procedural
Using Data Declarations to Set the Calculator Environment • VAR • ARRAY • Substitution variables