Sum of Expressions
Sum of Expressions over a Line Item Set or Hub is a Kind of variable in a Formula Layer. It allows you to create an expression for each line in a Line Item Set , or each child of a Hub, and then sum the results of the calculations.
A typical use is a sum of products. Simply stated, a sum of products is an expression a*b +c*d + x*y + ... Using this as an example, the variables a, c, and x are the line items in the line item set (or the values in a hub). b, d, and y can be a corresponding variable in the same FO Instance An FO Instance inherits all parameters and any logic(formulas) contained in the FO. Any change in the FO is immediately updated in all instances..
Example: Let's say we want to allocate various expense line items to three different departments. A FO Type could be created (Let's call it 'Allocated Expense') that has a Line Item parameter for the expense to be allocated, and three percentage line items (or Constants) that contain the percentage to be allocated to each department. Any number of instances of the FO can be created, each with its own expense value and percentage allocations for each department. We would use a Sum of Product Line Item Set to calculate the expenses for each department.
Usage
- In a formula layer, create a new Let Statement or Step.
- For , select .
- Select the that contains the line items that will be used.
- By default, a new variable 'v' will be added, representing each line in the set or hub.
- If you want to multiply each line item by a variable in the same FO Type , for ,
- Select the FO Type corresponding to the line items in the Line Item Set or Hub.
- A Let statement will appear with a variable (p1 by default) and a list of all the parameters in the FO Type.
- Select the parameter you want to use in 5 below.
- Repeat a through c to add more variables
- In the text field for , enter an expression, that might be as simple as "v * p1", which would instruct the software to multiply each line item by the variable p1 and sum them.
Continuing the example from above: First, create a Line Item Set (Title it 'Allocated Expenses LISet') that uses as the , and select the FO containing the expenses to be allocated. Then, for each department (e.g. Dept 1), add a formula, and in the first step select . For the , select . Add a variable (p1) by selecting the FO Type , and then selecting the percentage parameter for the department we are working on (e.g. Dept 1). For , type in 'v * p1'. The software will multiply each line item (allocated expense) by the corresponding variable p1 (the percentage for the department) and sum them.
The formula does not necessarily need to follow the pattern a*b +c*d + x*y , where a, c, and x are the individual lines in the line item set, and b, d, and y are the corresponding variables in the same FO Instance An FO Instance inherits all parameters and any logic(formulas) contained in the FO. Any change in the FO is immediately updated in all instances.. If you were to enter for , '.6' instead of p1. you could think of the resulting formula as either:
- a*.5 + c*.5 + x*.5
or
- .5*(a+c+x)
They are mathematically equivalent.
Additionally, the expression you enter in can use variables defined in as Let Statements In a Formula Projection, a statment that defines a variable for use in one or more formula steps. earlier in the formula layer, including conditional expressions.
Expression Operators and Functions