calculate-column adaptor applies one of the following mathematical operations using values in two columns in a datatable:
add: Adds values in left column to values in right column (left + right).
subtract: Subtract values in right column from values in left column (left - right).
multiply: Multiplies values in left column by values in right column (left * right).
divide: Divides values in left column by values in right column (left / right).
percent: Calculates the percentage ratio of values in left column out of values in right column (left / right * 100).
exponent: Calculates values in left column (raised) to the (power of) of values in right column (left ** right).
data
Type: datatable
Required: Yes
The datatable containing the column to be formatted.
left column
Type: text
Required: Yes
The name of the column containing the values on the left-hand side of the operator.
right column
Type: text
Required: Yes
The name of the column containing the values on the right-hand side of the operator.
operation
Type: text
Required: No
The calculate operation to be used. Can be either add, subtract, multiply, divide, percent, or exponent. If unspecified, defaults to add.
result column
Type: text
Required: No
The name of the column to which the calculated values will be added.
result unit
Type: text
Required: No
An optional unit to be appended to the result. If unspecified, defaults to blank.
data
Type: datatable
A datatable with formatted values.
Example 1: Default behaviour.
data:
Location
January case count
February case count
left column: January case count
right column: February case count
Location
January case count
February case count
result
-> Added the values in January case count column to the values in February case count column. Results were displayed in a new column.
Example 2: Calculate percentage column.
data:
left column: Sales
right column: Total
result column: Percentage
result unit: %
data:
Month
Sales
Total
Percentage
-> Calculated the percentage ratio of values in Sales column out of values in Total column. The result was added to the Percentage column.