VariablesYou perform arithmetic calculations using variables that define the column to use and the level (of expansions). Variables use this format: <ColumnName>[<Level>] You can use any column name in the structure browser. When defining a level:
You can define the label used for aggregate functions, such as SUM or AVG, using <ColumnName>["Label"]. SyntaxAn arithmetic calculation uses this syntax: <LHS>=<RHS> LHS is Left Hand Side; RHS is Right Hand Side. RHS is optional; if not provided it defaults to the variable <ColumnName>[CURRENT], or <ColumnName>. When used, RHS must be a cell variable and defines where to put the calculated variable in the structure browser. LHS can use any arithmetic operations (+ - * / %), arithmetic functions, or aggregation functions and can reference other cell variables. The arithmetic functions include all those supported by the JavaScript Math class. In addition, you can use the string function Concat. Concat("Bal: ", Jan + Feb + Mar) The function can call any string or arithmetic expressions. This table lists the supported aggregation functions:
ExamplesSay you want to calculate a Session Total, which is the sum of the values for the columns with names Jan, Feb, and Mar. You could perform this calculation using this expression: "Jan[CURRENT] + Feb[CURRENT] + Mar[CURRENT]" or Session Total[CURRENT]="Jan[CURRENT] + Feb[CURRENT] + Mar[CURRENT]" The results of the arithmetic expression are shown in the Session Total column. This next example uses parent/child nodes. A structure browser page includes an Organization that can be expanded to show Companies within that organization, and each Company can be expanded to show the Business Units within the company. You can total the cost of all children objects using this expression: Cost=SUM(Cost[CURRENT+1]) or Cost[CURRENT]=SUM(Cost[CURRENT+1]) For each company, the Cost column shows the total for all business units; for each organization, the Cost column shows the total for all companies. To prevent the calculation from being applied to business units (which have no children in this example), you can use this expression: Cost[0,1]=SUM(Cost[CURRENT+1]) or Cost[CURRENT,!LEAF]=SUM(Cost[CURRENT+1]) The first expression indicates to execute the expression for all root (organization) and their children (companies), and for no further levels. The second expression indicates to execute the expression for all levels except the leaf (final) level. |