Rules are sets of formulas defined on members of the same Entity. Rules can be created under the Rules section of a Data model. 

Using a rule, it is possible to define a specific member as the result of a formula involving other members of the same Entity, regardless of any Selection that may be active on that Entity.

A rule is always associated with a single Entity and can be used with (or applied to) all Cubes that have that Entity as a dimension in their structure.

The selected rule 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") and in order for them to work, they need to be used in a Layout with their associated Entity set by row or by column.
If the Entity is set By Row, it is possible to add another Entity in the same axis 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. It is not possible to add another Entity By Column when the Entity that is defined by the Rule is set By Column. Read more here.
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 added from the Data panel of the Layout editor, in the "MORE" sub-page.