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

  1. In a formula layer, create a new Let Statement or Step.
  2. For Kind, select Sum of Expressions over Line Item Set or Hub.
  3. Select the Line Item Set or Hub that contains the line items that will be used.
    1. By default, a new variable 'v' will be added, representing each line in the set or hub.
  4. If you want to multiply each line item by a variable in the same FO Type , for FO Parameter variables from each line item,
    1.  Select the FO Type corresponding to the line items in the Line Item Set or Hub.
    1. A Let statement will appear with a variable (p1 by default) and a list of all the parameters in the FO Type.
    2. Select the parameter you want to use in 5 below.
    3. Repeat a through c to add more variables
  5. In the text field for Expression (for each line item in set), 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 FO Parameter Type as the Kind of Match, 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 Sum of Expessions over Line Item Set or Hub. For the Line Item Set, select Allocated Expenses LISet. Add a variable (p1) by selecting the FO Type Allocated Expense, and then selecting the percentage parameter for the department we are working on (e.g. Dept 1). For Expression (for each line item in set), 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 Multiply each item in the line item set by, '.6' instead of p1. you could think of the resulting formula as either:

 

  1. a*.5 + c*.5 + x*.5

or

  1. .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.

Formula Layers

Expression Operators and Functions