Calculated Cube Formula Editor

Select the Edit Formulas item in the context menu of the calculated cube in the object navigator to specify or edit the calculation formula. The option is available only in the desktop application.

The value editor for the calculated cube, with defined formula management looks as follows:

The Destination Dimensions field is used to display the unrecorded dimensions of the destination cube. Under the Source Dimensions area, the unrecorded dimensions of the cube selected in the Source cube field are displayed.

One of the cube dimensions is active. The dimension tree area is displayed under the name of the active dimension.

Other dimensions are displayed under the active dimension tree area. Each dimension has a drop-down elements list with the button that activates a dimension when pressed.

A context menu is available in the dimension element tree area:

The Period list is available if formulas are managed for the calculated cube, and it contains all formula actual periods for the selected destination cube coordinate.

An expression, by which the value is calculated in the selected destination cube coordinate is created in the Expression box. On defining name of formula element by cube selection, the user can define its layout using context menu options:

Searching for a Dimension Element

To search for dimension elements:

The standard search dialog box is displayed when one of operations is executed:

Use the Find Next item for a sequential search. Focus moves to the next positive identification consecutively. Use the Close button to finish the search procedure and close the dialog box.

Formula Actual Periods

The Period list includes all formula actual periods for the selected destination cube coordinate.For every period, the concrete formula for value calculation is specified.

Select the Add context menu item to add period. A dialog box opens where you can create a period:

Specify the period start and end dates. Click the OK button to add a specified period to the list.

NOTE. In case the new period overlaps the existing one, an appropriate message appears. If positive variant is selected, a new period is added (edited), and all the periods are completely contained within it are to be deleted and the periods partially contained in the new period are edited so that they do not overlap.

Select the Edit context menu item to edit the selected period. A dialog box equal to the Period dialog box opens (see above).

Select the Delete context menu item to delete the selected period. A confirmation dialog box opens.

Creating a Formula

The formula is specified for the destination-cube coordinate (point). Select all the cube dimensions to form the coordinate. The source-cube coordinates are also used in the expressions.

To add a source cube coordinate to the expression, for destination cube coordinate:

After this the current position of the Expression box displays expression element corresponding to source cube coordinate.

If a calculated cube uses a formula actual period, and there are no periods created for the selected coordinate of the destination cube, any of these actions opens a dialog box for creating a period (see above).

You can use multiple selection in a source dimension on creating an expression. After creating multiple selection and selecting the Add to Formula item.

You can use various mathematical functions and operations to create an expression. The appropriate buttons are located below the Expression box:

Button Description
+ Addition.
- Subtraction.
* Multiplication.
/ Division.
= "Equals" sign.
<> "Non equal" sign.
< "Less than" sign.
> "Greater than" sign.
<= "Less or equal" sign.
>= "Greater or equal" sign.
() Brackets.
AND And.
DIV Integer division. It returns the integer portion of a division.
IIF Conditional operator: IIF(<condition>,<expression if the condition is correct>,<expression if the condition is incorrect>).
LAGVAL Getting value with offset by calendar dimension with the specified lag: LAGVAL(@<element>, <lag determining the offset>).
If the lag value is positive, the offset is backward by the calendar dimension. If the lag value is negative, the offset is toward by the calendar dimension. The offset is executed by the calendar level where the current calculation point is located. To provide a correct work of the function, the definition of lags for dimensions may be required.

NOTE. If cube contains several calendar dimensions, the first by order calendar dimension is used.

MOD Integer division. It returns the remainder of a division.
NOT Negation.
OR Or.

TIP. To get examples of expression creation, see the Examples section.

Closing the formula editor automatically saves the selected source cube, the order of the source cubes and destination cube dimensions, the selected dimension elements, the way the names are displayed in dimensions and formulas and the parameters based on which the dimensions are built. On the next opening of the calculated cube formula editor it is opened using the saved settings.

To save a formula, select the Cube > Save main menu item.

Using Application Functions

Application function can be used to calculate formulas. Function can contain any number of parameters (mandatory or optional) and must return any simple data type. Cube coordinates can be passed to the function. To do this, in the function signatures, parameters with the following type must be declared ICalculatedCubeInstanceCoord. If a coordinate is specified in expression, the actual value by the specified coordinate is to be calculated. Example: Calc_Functions.Sample1(Russia|2000). To pass the coordinate itself to the function, described by the ICalculatedCubeInstanceCoord interface, set the @ symbol in front of coordinate. Example: Calc_Functions.Sample2(@Russia|2000).

Changing Parameter Value

If the destination cube is parameterized, it is possible to reopen it with new parameter values. To do this, select the Cube > Change Parameter Values main menu item. The Determine Parameter Values dialog box opens, where required values can be defined. If the destination cube is not parameterized, the cube is reopened.

Closing the Formula Editor

To close the formula editor:

If the created or edited formulas are not saved before closing the editor, a message prompting the user to save these formulas is displayed. If the answer is Yes, the formulas are saved, otherwise they are not.

See also:

Cubes | Calculated Cube Wizard