Adding Business Logic to Cubes
Business logic represents a set of features that you can add to existing cubes. They are usually comprised of one or more rule templates, and may also add features to existing dimensions. To be fully operational, you may have to extend other database content.
To add business logic to cubes in either Jedox Web or Excel Add-in:
- Open the Modeler.
- In the hierarchy structure of a database, right-click on the relevant cube and select Add business logic... from the context menu, as shown:
- A dialog is displayed, prompting you to select a template. Select the type of business logic you want to add according to the templates available, that is, Version Blending, Previous Year, KPI Calculation, and KPI Calculation (by Version). See the descriptions below.
Version blending
Version blending business logic adds rules that blend values from the actual version into forecast versions. Note that version blending is only possible on cubes with both a Version and a Month dimension.
The logic assumes that a Version dimension exists in the database; if missing, this dimension will be created. The Version dimension requires an Actual Months attribute, which will also be created if it doesn't already exist. Furthermore, it uses a Month dimension (created, if missing) of type "Time". Finally, the business logic adds a rule template to the cube. This rule will then fetch values from the actual version for the number of months in the Month dimension, as defined on the Actual Months attribute of the Version dimension.
You can find more information about this business logic and an example in Version Blending.
Previous Year
This logic adds rules for the Previous Year version to the cube. It shows 'Version':'Actual' values of one year before on the 'Version':'Previous Year' version.
Make sure that the dimensions Version and Month already exist in the cube before adding the business rule.
KPI Calculation
KPI Calculation allows you to control the calculation of key performance indicators in a controlling dimension. The calculation is based on expressions stored in an attribute of the calculated element in that dimension.
When adding this business logic, you must specify the controlling dimension, which can be an existing dimension that contains KPIs, or a new dimension; in the latter case, that dimension will be created. Attributes called Calculation and CalculationDependencies will be added to this dimension. The dependencies attribute can be left empty (in this case, the rule always applies) or receive an expression (read more about dependencies and Jedox syntax below). In the cube itself, a rule template for the KPI Calculation is added.
Further down in this article you find an example of KPI Calculation.
KPI Calculation (by Version)
KPI Calculation (by Version) operates in a similar way to KPI Calculation but calculates the KPI based on a selection from the Version dimension. The calculation is based on expressions stored in an attribute of the calculated element.
This business logic is useful when the KPI calculation is different for actual data and planning data. Therefore, the Version elements are grouped into calculation schemas.
When adding this business logic, you must specify the controlling dimension, which can be an existing dimension that contains KPIs, or a new dimension; in the latter case, that dimension will be created. Four attributes (PCalculation, PCalculationDependencies, ACalculation, and ACalculationDependencies) will be created in the controlling dimension if missing. In the Version dimension (created if missing), an attribute called Calculation Schema is created.
The standard configuration defines the following two calculation schemas:
Calculation Schema |
Definition |
|
Calculation in the Actual version. |
|
Calculation in planning versions. |
This assignment is defined by the Calculation Schema attribute of the Version dimension. You do not need to follow this standard configuration, but the calculation schema must be represented by a single uppercase letter.
If the Calculation Schema attribute is empty, no calculation applies to this version.
When defining values for the Calculation Schema attribute in the Version dimension (e.g. "A" or "P"), the KPI calculation for that version will automatically use the matching definition from the controlling dimension's attribute.
The dependencies attributes can be left empty (in this case, the rule always applies) or receive an expression (read more about dependencies and Jedox syntax below).
Check also our example of KPI Calculation.
Business rules syntax
Jedox business rules syntax is mostly straightforward, working through expressions - the example below should make it clear. The expression must not contain the target nor the equal sign. It may contain an optional cell-type restriction (B: or C:) followed by any valid rule expression.
For detailed information, read also Business Rules Overview.
Dependencies
When the dependencies attributes are left empty, the calculation is always valid.
It is possible to add a dependency as an expression to any of the dependencies attributes. For example, you could specify a single cube for the rule, i.e., Cube:<cubename>. So, if the expression Cube:Human Resources
is included, the calculation will only be active if the Human Resources cube exists. This is particularly useful when you are not sure about the existence of certain cubes.
Example: KPI Calculation
Consider you have an Account dimension, which is used as the controlling dimension, i.e., its elements are targets of the KPI calculation (in other words, KPIs are elements in this dimension).
The Account dimension contains the elements 'Revenue' and 'Headcount', as well as the element 'Revenue per head', which is a KPI and should be computed with the KPI calculation.
-
Add the KPI Calculation business logic to your cube.
-
In the Calculation attribute of 'Revenue per head', include the following expression:
['Account':'Revenue'] / ['Account:'Headcount']
Rules can be much more complex than this, containing any functions.
For a slightly more detailed example, suppose the 'Headcount' element above is stored in a separate cube, called Human Resources, which has an additional Cost Center dimension that is not used in the target cube.
Then the Calculation attribute of 'Revenue per head' should be:
['Account':'Revenue'] / 'Human Resource'['Account:'Headcount','Cost Center':'All Cost Centers']
Updated November 5, 2024