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:
Name in Dimension. If this item is selected, its drop-down menu is available; the contents depends on the dictionary attributes list. Use this menu to select one of the available attributes, which are used to form the names of dictionary elements.
Name for Formulas. If this item is selected, its drop-down menu is available; the contents depends on the dictionary attributes list. Use this menu to select one of the available attributes, which are used to form the names of formula elements. The drop-down menu contains the item:
Show/Hide in Formulas. This item determines whether elements are visible in the formulas. If all the cube coordinates are not visible, the formula will contain the <Hidden item> text.
Expand Hierarchy. Expands the dimension hierarchy.
Collapse Hierarchy. Collapses the dimension hierarchy.
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:
Do not Show Data Sources. Data sources for the formula element are not displayed.
Show Data Source Names. Shows names of the sources that belong to the given formula element only.
Show Data Source Identifiers. Shows identifiers of the sources that belong to the given formula element only.
Show Names and Identifiers. Shows names and identifiers of the sources that belong to the given formula element.
To search for dimension elements:
Press CTRL+F.
Select the Find context menu item.
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.
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.
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:
Double-click an element of active source dimension.
Select the Add to Formula item in the context menu of the active source dimension.
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.
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).
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.
To close the formula editor:
Select the Cube > Close main menu item.
Press CTRL+F4.
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: