Performing simple calculations across sub-scenarios
The Filtered Summary block performs simple calculations across a set of sub-scenarios. This is an alternative to iterating over a set of sub-scenarios. The Filtered Summary block can operate on only floating point values. You can use this block to calculate sums and averages. See
Filtered Summary v2.0 for details.
In more general terms, the Filtered Summary block performs calculations on a keyed set of floating point values. Typically, you use the sub-scenario instance ID as the key. The key’s associated value is the value of a sub-scenario floating point variable that you want to use in an aggregate calculation.
To use the Filtered Summary block, wire output fields from the scenario block to input fields of the Filtered Summary block. Typically, you want to map the scenario block instance id output field to the Filtered Summary key input field. Then map a floating point sub-scenario variable from the scenario block output feed to the Filtered Summary value input field.
You can specify filters to perform calculations on a sub-group of sub-scenarios. For example, suppose you wanted to calculate the total number of shares purchased by sub-scenarios owned by John. To accomplish this, you do the following two things:
Map the scenario block
instance owner output field to the Filtered Summary block
filter input field.
Set the Filtered Summary
filter parameter to
"John".
When the Filtered Summary block receives input from your scenario block, it checks whether the value of the filter input field is equal to the value of the filter parameter. If the values are equal, (in the example, they are both "John") the Filtered Summary block sends output to its output feed. If the values are not equal, the Filtered Summary block sends no output.
Now suppose that you want to exclude shares purchased by John from your calculation. That is, you want to know the total number of shares purchased by everyone except John. To make this happen, you perform one step in addition to the steps already described. Set the Filtered Summary block’s filter is "not equal to" parameter to true. Now the Filtered Summary block sends output only when the filter input field is not equal to "John".
You can also remove keys and their associated values from the Filtered Summary block’s internal data store. This lets you exclude data from certain sub-scenarios from the calculations. You do this with the deleteKey operation and the keyToDelete parameter. One way to do this is to define a global rule that watches for sub-scenarios to terminate. When a sub-scenario terminates, you can specify its instance ID as the key and remove the data for that key from the Filtered Summary block’s store of data.
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.