The Calculated Facts page is used to set formulas for calculated facts. Calculated facts is a function from values of other facts, calculated facts or relations.
All cube facts are displayed on this page:
- facts linked to data set fields.
- facts not linked to data set fields. A formula, by which values can be calculated, can be determined for them. After the formula is specified, facts' markers change to .
To specify a formula:
Double-click a calculated fact.
Select a calculated fact and click the Edit button.
After any of these operations a dialog box opens, where the user can edit calculated fact parameters:
Determine an expression for the fact in the Formula box. To do this, click the button. The expression editor opens. To create an expression, use existing cube parameters, relations, facts and special functions.
As a formula value, the user can also specify the path to a custom function that will be used to calculate value of the calculated fact. The path is specified as follows: [Unit/form identifier].[Function name]. Access to the cube data, which can be used to calculate values, is executed by the CubeClass class.
When the Calculate by Physical Data checkbox is selected, first, the matrix with source data will be estimated which is extracted according to the specified selection, and next the calculation is executed only in the points with data.
NOTE. The selected checkbox affects the calculation of cube relations if the relation is set as a custom function. For example, if the ForeVariantType.Matrix array containing integer values is set as an input T parameter, the custom function also process and return array of integer values on relation calculation.
If the checkbox is not selected, the calculation will be executed according to the specified dimension selection: calculation in each point of obtained Cartesian product of selected elements.
Features of calculated fact calculation:
If a calculated fact formula uses special functions (DIF, FIL, SUM, and so on), the calculated fact value will be calculated only at the points with required data in the source matrix.
If a calculated fact formula uses relations that execute shift or take specific fact value, the calculated fact value will be calculated only at the points with required data in the source matrix.
If shift must be executed from the selection that is not contained in the matrix, the value is not calculated.
The Always Insert to Selection checkbox allows for including a calculated fact on calculation of output cube matrix. The checkbox does not affects the visual selection on working with a cube in various tools of Foresight Analytics Platform, and it is relevant on working with a cube on application macros that calculate the cube and work with cube data. The calculated facts, for which the checkbox is selected, are always calculated on calculation of output cube matrix. If the checkbox is deselected, the calculated fact is calculated if it is included in the selection in the application macro.
A calculated fact can change other fact values. To do this, select the Permit Data Editing checkbox and define advanced parameters:
Fact. Select a cube fact to change its value in the drop-down list.
Formula. Click the button to create an expression that should be used to change value of the fact selected above. The expression editor opens.
NOTE. If a formula is not specified, changed values of the calculated fact are not saved to the cube.
Sometimes it is required to specify lags to calculate cube facts correctly.
NOTE. The option is available if calendar dimension is set in the cube.
To specify lags, click the Specify Lags button. The Calculated Fact Lags dialog box opens:
Set the following parameters:
Calendar Level. Select calendar level in the drop-down list.
Backward Lag. When this parameter is set, the selection by the corresponding calendar level is increased backwards; the default value is 0.
Forward Lag. When this parameter is set, the selection by the corresponding calendar level is increased forward; the default value is 0.
See also: