cascadeProjectionValues with cascadeType = "sum"¶
Note
In the examples below, whenever a valuation date is mentioned, we only use the month name, for brevity. Instead
of February, you would write something like DATE(2021,2,28) or EOMONTH(DATE(2021,2,1),0).
Equivalence with mapProjectionValues¶
At each time step, the sum is taken of the values at the corresponding time step in all projection nodes in the series:
cascadeProjectionValues(varName, valnType, hLevel, January, March, 1, 0, 0, "sum", "sum")
│ │ │ └──┬────────────────┘ │ │
= mapProjectionValues(varName, valnType, hLevel, January, 0, "sum")
+ mapProjectionValues(varName, valnType, hLevel, February, 0, "sum")
+ mapProjectionValues(varName, valnType, hLevel, March, 0, "sum")
To make the summing easier to reason about, unavailable or out-of-bounds values are treated as 0 rather than N/A.
Note that valnDateMonthsShift has no effect when cascadeType = "sum".
Examples¶
The examples below are all demonstrated in this example workbook.
Say you have a model with a single hierarchy node. There are some projection nodes using valuation type valnTypeData
that contains some data in variable VarA. The starting projection node uses valuation type valnTypeCpv and valuation
date January.
Simple example¶
The variable named VarASimple has the following formula:
cascadeProjectionValues("VarA","valnTypeData",1,February,April,1,0,0,"step","sum")
The precedents will be:
| # | Valuation type | Valuation date |
|---|---|---|
| 1 | valnTypeData |
February |
| 2 | valnTypeData |
March |
| 3 | valnTypeData |
April |
Say the precedents contain the following results:
Precedent 1
| t | Date | varA |
|---|---|---|
| 1 | February | \(x_1\) |
| 2 | March | \(x_2\) |
| 3 | April | \(x_3\) |
| 4 | May | \(x_4\) |
Precedent 2
| t | Date | varA |
|---|---|---|
| 1 | March | \(y_1\) |
| 2 | April | \(y_2\) |
| 3 | May | \(y_3\) |
| 4 | June | \(y_4\) |
Precedent 3
| t | Date | varA |
|---|---|---|
| 1 | April | \(z_1\) |
| 2 | May | \(z_2\) |
| 3 | June | \(z_3\) |
| 4 | July | \(z_4\) |
The results for this variable will be:
| t | Date | VarASimple | Explanation |
|---|---|---|---|
| 1 | January | \(0 + 0 + 0\) | Look up January in all precedents. |
| 2 | February | \(x_1 + 0 + 0\) | Look up February in all precedents. |
| 3 | March | \(x_2 + y_1 + 0\) | Look up March in all precedents. |
| 4 | April | \(x_3 + y_2 + z_1\) | Look up April in all precedents. |
| 5 | May | \(x_4 + y_3 + z_2\) | Look up May in all precedents. |
| 6 | June | \(0 + y_4 + z_3\) | Look up June in all precedents. |
With timeShift¶
Variable VarATimeShift has the following formula:
cascadeProjectionValues("VarA","valnTypeData",1,February,April,1,0,1,"step","sum")
This is the same as the simple example, but with timeShift=1. The precedents are the same, and the
same precedent is used at each time step as in the simple example. However, at each time step, the
date of a different time step is looked up from the precedent.
The results for this variable will be:
| t | Date | VarATimeShift | Explanation |
|---|---|---|---|
| 1 | January | \(x_1 + 0 + 0\) | Look up February in all precedents. |
| 2 | February | \(x_2 + y_1 + 0\) | Look up March in all precedents. |
| 3 | March | \(x_3 + y_2 + z_1\) | Look up April in all precedents. |
| 4 | April | \(x_4 + y_3 + z_2\) | Look up May in all precedents. |
| 5 | May | \(0 + y_4 + z_3\) | Look up June in all precedents. |
| 6 | June | \(0 + 0 + z_4\) | Look up July in all precedents. |