Use of Rules in Layouts
  • 14 Jun 2024
  • 3 Minutes to read
  • Dark
    Light

Use of Rules in Layouts

  • Dark
    Light

Article summary

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" submenu.

contents/assets/images/rule in a layout.gif

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 Axes 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.

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 Axes 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.

Rules can also be added from the blue plus icon in the Layout:

contents/assets/images/rule from dp.gif

Or, from the Data panel of the Layout editor, in the "More" subpage, by dragging and dropping them into the Data area:

contents/assets/images/RuleofLayout.More.gif

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 Axes 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 "Area" 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 "Year", and add it as the first Entity in the "By Row" field as shown below.
contents/assets/images/Rules.layout.axes.example.rule.PNG

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.


Was this article helpful?