Functions (doing a calculation) Please use speaker notes for additional information!
UNIT 4 Calculation Script Architecture – Advanced Functions
description
Transcript of UNIT 4 Calculation Script Architecture – Advanced Functions
![Page 1: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/1.jpg)
UNIT 4
Calculation Script Architecture –
Advanced Functions
![Page 2: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/2.jpg)
Topics
• Range functions
• Relationship functions
• Iterative processing
• Simultaneous equations
• Environmental settings
• Variables
![Page 3: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/3.jpg)
Exploring Advanced Functions and Commands
• Range functions
• Relationship functions
• Iterative commands
• Environmental commands
![Page 4: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/4.jpg)
Calculating Values Using Range Functions
• Mathematical
• @SUMRANGE
• @AVGRANGE
• @MAXRANGE
• @MINRANGE
• Exceptions
• @CURRMBRRANGE
• @PRIOR
• Financial
• @SLN
• @IRR
• @COMPOUND
![Page 5: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/5.jpg)
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
![Page 6: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/6.jpg)
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
![Page 7: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/7.jpg)
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
![Page 8: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/8.jpg)
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” ;
![Page 9: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/9.jpg)
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
![Page 10: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/10.jpg)
Exercise 4-1:Calculating Values Using
Range Functions
![Page 11: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/11.jpg)
Obtaining Values Using Relationship Functions
• @PARENTVAL
• @ANCESTVAL
• @MDPARENTVAL
![Page 12: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/12.jpg)
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,
![Page 13: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/13.jpg)
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
![Page 14: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/14.jpg)
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);
![Page 15: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/15.jpg)
Exercise 4-2:Obtaining Values Using Relationship Functions
![Page 16: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/16.jpg)
FIX(New_York,Camera,Actual,Mar) LOOP(30) Commission = Profit * .15; Profit=Margin-Total_Expenses-Commission; ENDLOOPENDFIX
Controlling Execution Using Loop…Endloop
Use the LOOP...ENDLOOP command to specify the number of times to iterate a group of calculations.
Syntax:
![Page 17: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/17.jpg)
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.
![Page 18: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/18.jpg)
Exercise 4-3:Using Loop…Endloop to
Solve Simultaneous Equations
![Page 19: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/19.jpg)
Setting the Calculator Environment
• SET commands
• Enhance log information
• Determine Intelligent Calculation behavior
• Manage memory
• Variable declarations
• Scalar
• Arrays
• Substitution variables
![Page 20: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/20.jpg)
Using Set Commands to Set the Calculator Environment
• Information
SET MSG SET NOTICE
• Intelligent Calculation
SET UPDATECALC SET CLEARUPDATESTATUS
• OptimizationSET AGGMISSG SET CACHE SET LOCKBLOCK SET FRMLBOTTOMUPSET CALCHASHTBL
• Set commands are procedural
![Page 21: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/21.jpg)
Using Data Declarations to Set the Calculator Environment
• VAR
• ARRAY
• Substitution variables
![Page 22: UNIT 4 Calculation Script Architecture – Advanced Functions](https://reader035.fdocuments.in/reader035/viewer/2022062500/568159d1550346895dc720dc/html5/thumbnails/22.jpg)
Check Your Understanding