Syntax for Calculated KBIs
When you create a calculated KBI, you must create formulas that comply with LMS's built-in calculation syntax.
Overview of formula basics:
- The general form of a calculation is: VALUE OPERATOR VALUE
- A value can be a constant number, KBI, or function.
- A KBI, when used in a calculated formula, must be expressed as follows:
*#KBICODE\[n\]* |
* The KBI name must be prefaced with the pound sign (#). * The "n" within the brackets represents the following day offsets: ** Previous days are indicated by negative numbers (-1 represents yesterday, \-7 represents the previous week, etc.) ** Today is represented by a 0 ** Future days are indicated by positive numbers (7 represents next week, etc.) |
* Calculated KBIs use the following mathematical operators in the following priority: {indent:3} * Multiplication / Division % Modulo (divide and return the remainder) + Addition - Subtraction |
* Functions are predefined formulas that perform calculations by using specific values, called arguments, in a particular order or structure. A function is a procedure that generates a numerical value. The formula @PAVG(4,#1024\[0\]) is a function that returns the moving average for today's value of KBI #1024 for the last 4 weeks. |
Common Syntax Errors
Following are some common errors to watch out for when creating formulas:
- Omitting the pound sign before a KBI.
- Including only one pound sign when two are required. The system inserts a pound sign whenever it creates a KBI as the result of establishing market segments or revenue centers.
- Omitting day offsets ([n]).
- Omitting a bracket before or after a day offset.
- Putting parentheses rather than brackets around a day offset.
- Specifying non-existent or incorrect KBI codes.
Related topics:
- Functions
- Syntax for Calculated KBIs