Arithmetic operators
Arithmetic operators combine numeric values in formulas. Use them for simple calculations, KPI logic, and combining driver nodes.
When inputs have different dimensionality, arithmetic can also change the output shape.
Mental model
Arithmetic operators work row-wise on matching intersections of level values.
When inputs do not have the same dimensionality, the operator can change the output shape:
+and-aggregate both inputs to their common dimensions (the intersection of the shared dimensions)*and/calculate across the combined dimension set (the union of both inputs’ dimensions)
As a rule of thumb:
+and-keep the coarser level in each shared dimension*and/keep the finer level in each shared dimension
If your output shape matters, make the intended dimensionality explicit before combining nodes, for example with ROLLUP, ROLLUP_TO, EXPAND, or DROPLEVEL.
Operator reference
| Operator | Details | Use for | Common patterns |
|---|---|---|---|
+ | ADDITION (+) | Sum values | 'Revenue' + 'Other income' |
- | SUBTRACTION (-) | Compute deltas | 'Revenue' - 'COGS' |
* | MULTIPLICATION (*) | Multiply values | 'Price' * 'Volume' |
/ | DIVISION (/) | Calculate ratios | 'Profit' / 'Revenue' |
When to prefer a function
- Use
RATIO('Gross Profit', 'Revenue')when you want a ratio that keeps only the shared dimensions of both inputs - Use
ADDEACH('Sales', 1)when you want to add a constant to each value without relying on arithmetic shape behavior - Use
MULTIPLY('Price', 'Volume'),DIVIDE('Profit', 'Revenue')when you need stricter validation and clearer mismatch handling - Use
UNION('Revenue', 'Other income')when you want to combine result sets while enforcing matching levels and preventing silent overlap
Pitfalls & troubleshooting
- Wrong shape after
+or-: check whether the inputs were aggregated to their common dimensions before the calculation - Unexpected expansion after
*or/: check whether the result kept the combined dimension set - Unexpected level detail: remember that
+and-keep the coarser shared level, while*and/keep the finer shared level - Need stricter mismatch handling: use validated functions such as
MULTIPLY(...),DIVIDE(...)orUNION(…) - Sign mistakes: consider modeling cost positions as negative values and using
+consistently
Related sections
- Formula basics: evaluation order, constants, and quoting rules
- Dimensionality & hierarchies: functions for explicit shaping
- Troubleshooting guide: wrong shape, wrong numbers, and empty output