Applying conditional formatting to measures
Conditional formatting in the Analyzer data grid means that cells will be physically affected by the data they contain. The most common form of conditional formatting is stoplight reporting, where cell backgrounds are colored red, green, or yellow depending on user-defined thresholds. Analyzer offers some simple pre-defined methods of conditionally formatting numeric data.
Apply conditional formatting to measures
Procedure
Right-click a measure in the grid, then select Conditional Formatting from the context menu.
A sub-menu with conditional formatting types will appear.Select your preferred number format from the list.
Results
Conditional formatting types
You can apply several conditional formatting types in your Analyzer report.
Indicator Type | Description |
Color scale | The background cell color will be shaded according to the value of the cell relative to the highest and lowest recorded values in that measure. There are several color progressions to choose from. |
Data bar | The cell background is partially filled with a solid color proportional to the scale of the cell's value relative to the highest and lowest recorded values in that measure. |
Trend arrow | An upward or downward arrow is displayed to the right of the cell value depending on whether it contains a positive or negative value. |
Apply advanced conditional formatting with MDX expressions
Procedure
Right-click a measure in the grid, then select Column Name and Format from the context menu.
The Edit Column dialog box appears.Select Expression from the Format drop-down list.
A default MDX expression that prints green or red arrows in cells if their values are greater than or less than zero, respectively, appears in the MDX Format Expression field.Case When [Measures].CurrentMember > 0 Then '|#,##0|arrow=up' When [Measures].CurrentMember < 0 Then '|#,##0|arrow=down' Else '|#,##0' End
Modify the expression to suit your needs. Consult Conditional Formatting Expressions for more information on conditional formatting syntax and options.
NoteIf the MDX expression is invalid, an invalid report definition error appears at the top of the dialog box.Click OK to commit the change.
Results
Conditional formatting expressions
Valid MDX format strings contain properties that apply special rendering for the HTML pivot tables. A format string follows this syntax:
| # , # # # | style = red
The leading Pipe ( | ) tells Analyzer that this format string contains properties. The '#,###' is the measure's value format, which in this example is one number separated from three further places or decimal places by a comma, for example, '3,667'. The 'style=red' string is a key/value pair; all possible keys and values are explained in the table below.
The following properties are supported by Analyzer:
Indicator Type | Description | Values |
style | Changes the cell background color. |
|
arrow | Shows a trend arrow that points up or down. A value of 'none' will not render the arrow, which is useful when you only want to show one directional arrow instead of two. |
|
link | Creates an HTML link which will open in a new window when clicked in Analyzer. |
|
image | Renders a custom image that you specify. This image file must be stored in the /pentaho-solutions/system/analyzer/resource/image/report/ directory. | An image file name, with extension. |