Use of Rules in Layouts
This topic describes how to use Rules in a Layout definition.
Rules are usually used in reports, and can be applied to any Cube. This Cube has to contain the Entity (as dimension) on which the rule was defined.
The Rule calculation occurs on the fly during the Layout execution, meaning that the results of Algorithms are not stored in the Data model.
If the view on the Cube is at a summary level, the rule formulas are calculated after data has been aggregated to the required view level. This allows you to correctly calculate percentages and other values that are not the result of additions and therefore cannot be summed. This process is similar to the calculation logic of Algorithms in the Layout.
If a Rule refers to members that are outside of an active Selection, the formulas will only be calculated if the Entity on which the Rule was defined is also in the Structure of the Cube (at physical level).
To use a Rule in a Layout, select the Cube on which the Rule should be applied and then pick a Rule from the Block settings sliding right panel, under the "RULES" menu.
To apply a Rule where the Entity in which the Rule is defined is set By Row, the Layout must meet the following requirements:
- The "BY ROW" field in the Axis area cannot be empty
- The Entity on which the Rule is defined must be set By Row and be in the most-nested (rightmost) position
- An Entity of the same hierarchy as the Entity on which the Rule is defined cannot also be set By Row
If the Entity is set By Row, it is possible to add another Entity By Row as a grouping Entity (i.e. the one in the leftmost position in the "BY ROW" field). Those Entities must not be part of the same hierarchy.
You can apply a Rule to an Entity which contains an unbalanced hierarchy if the Entity is set By Row in the Layout.
Multiple Rules are supported in a single Dataflow Layout, but they must be applied to the same Entity on each Block.
To apply a Rule where the Entity in which the Rule is defined is set By Column, the Layout must meet the following requirements:
- The "BY ROW" field in the Axis area cannot be empty
- The Entity on which the Rule is defined must be set By Column
- No other Entity can be set By Column
If the Entity is set By Column, it is not possible to add another Entity By Column.
You can apply a Rule to an Entity which contains an unbalanced hierarchy if the Entity is set By Column in the Layout.
Multiple Rules are supported in a single Dataflow Layout, but they must be applied to the same Entity on each Block.
Rules can also be added from the Data panel of the Layout editor, in the "MORE" sub-page, by dragging and dropping them in the Data area.
In this case, the selected Rule is displayed as a separate Column in your report and is always applied to the values of the previous Data Block in the list, taking into account only the most nested Entity in the Axis area (i.e. the one in the rightmost position in the "BY ROW" or "BY COLUMN" field). Rules, therefore, cannot be the first Data Block in the list (Block "a").
Example
If a Rule is defined on the Entity "ProfitAndLoss" and you want to use it in a Layout, you have to set the Entity By Column or By Row. If you set it By Row, you can add another unrelated Entity, for example the Entity "Month", and add it as the first Entity in the "BY ROW" field as shown below.
Rules can be applied alongside Time functions in a Layout: in that case, the selected Time function is always executed before the Rule. Rules and Time functions cannot be enabled on the same Block.