Relations enable the user to get fact values using shift towards the current calculation point. It is used on creating expressions of cube calculated facts.
On creating a cube, data is extracted from sources, which are bound with cube facts and calculated facts values are calculated. Calculated facts are calculated individually in each cube cell. The addition of relation to the calculated fact formula enables, on calculating in the particular cell, the use of not only values specified for facts in this cell, but also facts in other cells obtained by shifting in cube dimensions. The shift can be set up by one or several dimensions at the same time. When used in a formula, each relation can be applied for different cube facts.
To add and set up relations, go to the Relations page of the standard cube wizard.


Formulas can be set up using the expression editor:
The expression editor in the desktop application is uniform for all platform tools and objects. The uniform expression editor is described in the Creating Formulas and Expressions document.
The expression editor in the web application differs depending on the configured tool or object.
The expression editor window for setting up relation formula in the web application looks as follows:

Create a formula of calculated expression for cube relation.
Arithmetic operations, functions, numbers, comparison characters and round brackets can be used in a formula. There are some features of use:
Functions can be inserted both using the keyboard or the special panel.
Numbers are inserted only using the keyboard.
Consider the example of creating a relation and setting up a calculated fact in the existing cube in the desktop application. It is supposed that the fact dimension contains an element named Change, which is not linked with data source and which is used to calculate values by formula.
Cube source data looks as follows:

To calculate changes of indicator comparing with the current and previous year, create a relation and set up its parameters. To get the previous value by calendar dimension, one should set up a relation: create a relation and name it Shift One Point Back and set the BEFORE identifier. Select Calendar, click the Change button and determine the following settings:

The created relation will get a previous value in each calculation point by shifting one element back in calendar dimension. To calculate indicator change, set up calculated fact. Go to the Calculated Facts tab, select the Change element and click the Edit button. Click the
Insert Formula button next to the Formula edit box. Create the Value-Shift One Point Back[Value] formula using elements from data panel in the expression editor. After clicking the OK button, all names will be replaced by identifiers and the calculated fact editor will look as follows:

Save all changes and close the cube wizard. Now, if cube will be opened and selection will be added to calculated fact, cube data will look as follows:

See also: