Cumulative
Calculates the total of the preceding period’s values for a specified account.
Return Value
Returns a string of characters representing the correct expression to be used as part of the HS.EXP function.
Syntax
Cumulative (PointOfView, View, NumPeriod)Table 13-5 Syntax of Cumulative Function
| Parameter | Valid Values | 
|---|---|
| 
                                  PointOfView  | 
                              
                                  Valid combination of Account, Custom1….4, ICP members, for example, "A#CASH.C1#[None].I#[ICP Top]"  | 
                           
| 
                                  View  | 
                              
                                  Must be one of these values: "" " " (double quote) - Based on the default view defined for the scenario being processed (either YTD or Periodic). YTD - User specifies the Year-to-date option, which overrides the default view set for the scenario. Periodic - Specify the periodic option, which overrides the default view set for the scenario.  | 
                           
| 
                                  NumPeriod  | 
                              
                                  A whole number representing the number of periods in the current scenario to accumulate, starting with the current period. If NumPeriod is 0 or negative, the function aggregates from the beginning of the current year.  | 
                           
Detailed Description
This function calculates the sum of either the periods specified or the sum year to date for the specified account. By default, the view of the accumulated data is the scenario default; however, you can override this for flow type accounts.
- 
                        
If the View parameter is YTD, the function accumulates the year-to-date values.
 - 
                        
If the View parameter is Periodic, the function accumulates the periodic values.
 - 
                        
If the View parameter is blank ( " " ), the function accumulates the data using the scenario default view.
 
Example
The CASH account will return the following values for January, February, and March 2014 depending on the Number parameter used in the Cumulative function.
The a SALES account will return the following values for January, February, and March 2014 depending on both the View and Number parameters used in the Cumulative function. The default view set for the scenario being processed is YTD.
Table 13-6 Example of Cumulative Function
| Account | Oct2013 | Nov2013 | Dec2013 | Jan2014 | Feb2014 | Mar2014 | 
|---|---|---|---|---|---|---|
| 
                                  A#Cash  | 
                              
                                  1,000  | 
                              
                                  1,500  | 
                              
                                  1,200  | 
                              
                                  800  | 
                              
                                  1,100  | 
                              
                                  1,300  | 
                           
| 
                                  Cumulative ("A#Cash","0")  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  800  | 
                              
                                  1,900  | 
                              
                                  3,200  | 
                           
| 
                                  Cumulative("A#Cash", "3")  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  3,500  | 
                              
                                  3,100  | 
                              
                                  3,200  | 
                           
| 
                                  A#Sales  | 
                              
                                  9,000  | 
                              
                                  10,500  | 
                              
                                  11,700  | 
                              
                                  800  | 
                              
                                  1,900  | 
                              
                                  3,200  | 
                           
| 
                                  Cumulative("A#Sales", "0")  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  800  | 
                              
                                  2,700  | 
                              
                                  5,900  | 
                           
| 
                                  Cumulative("A#Sales", "Periodic", "0")  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  800  | 
                              
                                  1,900  | 
                              
                                  3,200  | 
                           
| 
                                  Cumulative("A#Sales", "Periodic", "3")  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  N/A  | 
                              
                                  3,500  | 
                              
                                  3,100  | 
                              
                                  3,200  | 
                           
Sample Script
' sample statement written in the calling routineSub Calculate()HS.EXP "A#TOT_Cash =" &Cumulative("A#Cash","" ,0)End Sub' programming of the Cumulative functionFunction Cumulative(StrPov, StrVIEW, nPERIOD)DIM strCUM
DIM iIF nPERIOD <= 0 THENnPERIOD = HS.PERIOD.NUMBER() - 1ELSEnPERIOD = nPERIOD - 1END IFIF strVIEW = "" THEN strVIEW = HS.SCENARIO.DEFAULTVIEW("") END IFstrPOV = UCASE(strPOV)
strVIEW = UCASE(strVIEW)IF strVIEW = "PERIODIC" THENstrVIEW = ".W#PERIODIC"ELSEIF strVIEW =  "YTD" THENstrVIEW = ".W#YTD"ELSEEXIT FUNCTIONEND IFFOR i = 0 TO nPERIODIF i = 0 THENstrCUM = strPOV & strVIEWELSEstrCUM = strCUM &"+" & strPOV & strVIEW &".P#CUR-" &iEND IFNEXT  Cumulative = ""("" & strCUM &"")END FUNCTION