Create a Constraint Expression

Specify the **Member Name** in a Constraint Expression:

1. Open a slice (Use *Sales Account by Month* slice of the Avon Trading Company database).

2. In the PowerOLAP ribbon, select **Slice** tab, chose **Constrain Slice** command.

The **Edit Constraints** dialog box is displayed, with the cursor defaulting in the Row Constraints text box.

3. You may know what Members of the column Dimension you wish to constrain and can type the Member name without assistance. However, if you need prompting, and to ensure correct spelling, you can use the **Pick** button to pick the Members to which you want to apply a constraint.

4. Select ** Quantity**. Notice that the Member radio button is automatically selected.

5. Double-click on ** Quantity** or click

**OK**to return to the

**Edit Constraint**dialog box.

6. For this example, finish the expression ** Quantity>5** and click

**OK**.

7. Press **F9** to update the Slice.

Sample Constraints

The following expressions are further examples of constraints and their meanings:

*Quantity*> 20

(“Keep the rows where the column values in*Quantity*is greater than 20″)*Revenue*= 2129

(“Keep the rows where the column values in*Gross Profit*is equal to 2129″)*Cost of Sales*<> 122.30

(“Keep the rows where the column values in*Cost of Sales*is not equal to 122.30″)*Revenue*top 4

(“Keep the rows where the column values are the top 4 values”)

If both the *Regions* dimension and *Months* dimension are in Rows and the *Accounts* dimension is in Columns and you want to constrain Columns, then the constraint Member needs to be a Member of the innermost Rows dimension *Month*.

For example:

*January*< 2

(“Keep the columns where the row values in*January*is less than 2″)*QTR1*> 20

(“Keep the columns where the row values in*QTR1*is greater than 20″)*March*>= 100

(“Keep the columns where the row values in*March*is greater than or equal to 100″)*Total Year*bottom 15

(“Keep the columns where the row values in*Total Year*are the bottom 15 values”)

**Any and All**

Constraints using ‘Any’ or ‘All’ act on cells displayed along the opposing axis.

__If a constraint is composed for Rows:__

- Any < 100

(“Keep the rows where the column values in any cell is less than 100”) - All <> 25

(“Keep the rows where the column values in all cells is not equal to 25”)

__If a constraint is composed for Columns:__

- Any < 100

(“Keep the columns where the row values in any cell is less than 100”) - All <> 25

(“Keep the columns where the row values in all cells is not equal to 100”)

**Combining Constraints Expressions via AND and OR**

Constraint expressions can be combined using the Boolean operators AND and OR. Note that constraints joined by AND evaluate before other constraint expressions.

For example:

- Units < 2 AND ‘
*Gross Margin*‘ > 20 OR Revenue <= 25 - Price <= 25 OR ‘Units’ > 20 OR Revenue <= 5

Constraint expressions may also be parenthetically grouped.

For example:

- Units < 2 AND
*(‘Gross Margin*‘ > 20 OR Revenue <= 25)