Dynamic Pricing: Formulas
Explore how formulas in Dynamic Pricing enable flexible pricing models by using charge attributes, contextual values, and mathematical logic.
Formulas in Dynamic Pricing let you calculate prices dynamically by using price, labeled adjustments, supported attribute fields, and mathematical or conditional logic.
Dynamic Pricing formulas support attribute fields whose data type is Number or Integer. They also support the ABS(), SIGNUM(), and POW() functions.
Supported Fields
Field | Description |
|---|---|
Price | The base price value defined in the rate plan charge. |
Adjustment | A custom adjustment or modifier applied on top of the base price. To reference an adjustment in a formula, you must define a label for the adjustment and use that label in the formula. If an adjustment does not have a label, it cannot be used in formulas. Adjustment label requirements:
|
Number or Integer attribute | Attribute fields with a Number or Integer data type can be referenced in formulas. |
Currently, formulas do not consider attribute fields. Only price and adjustment are available as variables.
Supported Operators
Use
POW()for power calculations. The^operator is not supported.In addition to the previously supported math functions, Dynamic Pricing formulas support ABS(), SIGNUM(), and POW(). Other Java math functions are not supported.
Operator | Description | Example |
|---|---|---|
+ | Addition | price + adjustment |
- | Subtraction | price - adjustment |
* | Multiplication (into) | price * scaleFactor |
/ | Division | price / 2 |
( | Start of grouped expression | (price + adjustment) * scaleFactor |
) | End of grouped expression | (price + adjustment) * scaleFactor |
ABS() | Returns the absolute value of a number | ABS(adjustment) |
SIGNUM() | Returns -1, 0, or 1 based on whether the value is negative, zero, or positive | SIGNUM(Quantity) |
POW() | Returns a value raised to the specified power | POW(Quantity, 2) |
Do not use ^ for exponent calculations in Dynamic Pricing formulas. Use POW() instead.
Example
If an adjustment has the label
Discount10, you can reference it in a formula as follows:price - Discount10
If you want to use a supported number-based attribute in a formula, you can write a formula such as the following:
price * Quantity
If you want to calculate a power value, use a formula such as the following:
POW(Quantity, 2)