pentahoreport-designer

Dynamic background color for total cell


I'm using Pentaho Report Designer and I would like to change the background of the cell that contains the sum of all the measure values of a column based on the calculated value. For the measure values, this can be easily done defining a formula for the background property like the following one:

=IF([measure] >10; "red"; "green")

However, from the cell that shows the total, [measure] is always null.

How can I get the value of the cell (or the result of sum all the measure values)?

Thanks


Solution

  • Finally I've found how to do this. It is necessary to create a function to sum the values so it can be referenced later from a formula:

    1. Create a function to calculate the total (Add Function... > Summary > Sum)
    2. Inside the properties table, select Field Name for the function. Give it a Function Name to make reference to the formula later (i.e. budgetTotal)
    3. Use the function to apply the conditional formatting based on its value (i.e. =IF([budgetTotal] >10; "red"; "green"))