Custom colors on Pentaho Analyzer conditions

Almost everybody knows: using Pentaho Analyzer and also the old famous JPivot OLAP players, it’s possible to add conditional formatting to the measure fields.

This functionality is very useful when, for example, we have some KPIs and want to color it according to its performance, as in the following example:

In this picture, the customer wants to color with red, the Territory that shows Sales < 1000000, and to achieve that, we can enter the following MDX Expression in the Column Formatting:

When [Measures].[Sales] < 1000000
Then '|#,##0|style=red'
Else '|#,##0|'

However, if our customer wanted us to color the other cells with blue or other color contained in those 50 shades of something, we’d be in trouble.

…not actually!

Analyzer does something wise, while rendering these styles we deliver to the cells.

It renders in these formatted cells, within their <td> tag, the property class="cell-style-red",when it attends to the style=red condition.

This means we can do a lot of cool stuff. Everything that CSS enables us to do. Or only adding some colors that Analyzer doesn’t give us out-of-the-box for these conditions.

But where to add these styles?

The CSS class .cell-style-red is already included in the file:
The next step is to append our custom styles to this file and voilà.

This custom code:


…added to the css file, produces this result:

…if our MDX formula is something like this:

When [Measures].[Sales] > 1000000
Then '|#,##0|style=blue'
Else '|#,##0|style=red'

Okay, you wouldn’t want to add smileys and crazy colors to your report.

Just a


…would fit for you. 🙂


No Comments

Write a Reply or Comment

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *