Creating cube rules

This example describes how to create the rule Gross Margin in Percent=(Gross Margin/Average Price)*100 on the SALES cube in the Best Practices OLAP sample database.

To create the cube rule:

  1. Click Cubes in the Database group on the ribbon.
  2. Select the cube for which to create a rule. In this example, select SALES.
  3. Click Edit Rules.
  4. Click New Rule.
  5. Specify ['Gross Margin in Percent'] in the Target pane of the Edit Cube Rule dialog.
    Alternatively, click Internal Reference and, in the Cell Reference dialog, select the Gross Margin in Percent element from the Measures dimension.
    Note: 

    In the Target section of a rule you can enter several elements of a dimension, but you must enclose them in braces [Currtype:{USD, EUR}]. Or you can use the Select Several Elements button in the Cell Reference dialog to select the elements in the Dimension Browser. You can use subsets as well, but they must be public and static. Subsets must be enclosed in double braces [Products:{{TotalServers}}]. Use the Select Subset button to select the subset from the Select Subset dialog.

    In the Target section you cannot enter references to external cubes. The External Reference button is disabled for this area.

    SeeWriting rules to external cubes.

  6. Click the Rule pane and enter ['Gross Margin in Percent']. Or click Internal Reference and, in the Cell Reference dialog, select the Gross Margin in Percent element from the Measures dimension.

    Note: Subsets and the selection of several elements are not allowed as internal reference in the Rule area. The buttons Select Several Elements and Select Subset are disabled for the Rule area.
  7. Enter * in the Rule pane.
  8. In the Rule pane, specify ['Revenue'].
    Alternatively, click Internal Reference and, in the Cell Reference dialog, select the Revenue element from the Measures dimension.
  9. Select All Cells because the rule is to be applied to all elements.
  10. Click OK.
    The rules compiler runs a syntax check. If the syntax is correct, the rule is applied temporarily to the cube. The rule is displayed in the Cube Rules dialog.
  11. Save the rule.
    Note: 

    Changes made to rules or new rules are only permanently saved to disk when you save the entire database or when you save the cubes in the Cubes and Data Areas dialog. You can experiment with changing a cube rule, without making the changes permanent.

    See Saving cube rules to disk.