
Playing with conditional styles
Assume that the following report needs to be formatted such that quantities below 1.7 million will be highlighted with red background and those above 2 million should be green. Also, we need the negative values for Running Difference (month-on-month) to be shown in red and in brackets as shown in the following screenshot:

As shown in the previous recipe, this would have needed us to define two conditional variables. Then attach each to the corresponding column as Style variable to define the styles. With one more such numeric column, the author had to define one more variable and repeat the exercise. Let's see how the new conditional styling feature solves this problem.
Getting ready
Write a new report similar to the one shown in the previous screenshot.
How to do it...
In this recipe, we are going to examine more ways to enhance the reports look and feel. To do this:
- Select the Quantity column on the report page.
- Open the new Conditional Styles dialog box from the Properties pane. Alternatively, you can also click on the Conditional Styles button from the toolbar.
- Create a new Conditional Style as shown in the following screenshot:
- Choose Quantity to base the conditions on.
- Define three values (0, 1.7 million, and 2 million) by hitting the new value button in the bottom-left corner. This will look like the following screenshot:
- Also, choose corresponding styles for each range as shown in the previous screenshot. Give appropriate names, like
Quantity colors
in this case. - Similarly, define the negative values for the Running Difference column to be shown in red as shown in the following screenshot:
- Run the report to test it as shown in the following diagram:
How it works...
With this feature, we can now define styling for any column without explicitly defining the conditional variable. The styling can be based on the values on the column itself or some other column.
Also, defining actual formatting (font, color, border, and so on) for different conditions is now done within one dialog box. This is more author-friendly than traversing through the conditional variable pane and choosing each condition.
There's more...
The previous example defines very basic value-based range or classification.
You can also choose the Advanced Conditional Style option under this property, which allows you to define an expression and have better control over conditions than just classifying the values into ranges.