SubTotal(Type: PivotEvaluatorElementType,
Relation: Variant,
Position: PivotTotalPosition)
Type. Total calculation method.
Relation. Dimension element by which the calculated total must be obtained. Optional parameter. The parameter is set to Null by default.
Position. Total position (by rows/by columns). Optional parameter. The PivotTotalPosition.Default_ default value is position is not specified.
It returns the total value.
Mandatory condition for method working is enabling of required totals calculation for rows/columns of table. If totals are not calculated, the method returns empty values.
If the Relation parameter is not specified, the function returns the total of the element after which the calculated element is created. As a value of the Relation parameter, it is required to specify element of the dimension, for which a calculated element is created. On specifying the Relation parameter the function returns the grand total calculated by the specified element.
If the Position parameter is not specified, or the value matches the location of created calculated element, the function returns total of the element, for which transformation formula is set. If the value is specified that is opposite to calculated element location (the calculated element is located by columns, and thePivotTotalPosition.Rowsvalue is specified, and vice versa), the function returns subtotal value by rows/columns respectively.
When the Total method is used as a function in formula expressions, take the following into account:
If the calculated element is located in columns and the function is set with the Column Totals parameter, or the calculated element is located in rows and the function is set with the Row Totals parameter:
If the Total function is set for the current dimension item without specifying the particular item in the formula, and the appropriate total method is calculated for the table, the grand total will be calculated by this item.
If a new calculated element was added, and a formula is not calculated for it where the total could be taken, value of the Total function by this calculated element will be empty.
If another element is specified for the calculated element in the formula, the grand total will be calculated by the specified element.
If the calculated element is located in columns and the function is set with the Row Totals parameter, or the calculated element is located in rows and the function is set with the Column Totals parameter, value of the calculated element will correspond to value of the grand total by rows or columns, respectively.
If the total by rows or columns is not calculated, the corresponding function set in the formulas returns empty value.
Formula | Result | Application |
= Total(PivotEvaluatorElementType.Sum, Null, PivotTotalPosition.Rows) | The grand total located by rows as a sum of corresponding dimensions located above the calculated element. | It can be used in formulas of calculated elements. |
See also:
Functions Available in Expression Editor │ Totals │ IPivotClass.Total