Frage

I'm attempting to do conditional formatting on a column that contains percentages using Pentaho Report Designer (3.91). I would like to have a 3 condition format that gradually changes the color of the cell from red to yellow to green but I was unable to figure out how to do so. Alternatively I have tried to create a formula expression through the formula editor (Structure-->Style-->bg-color) that defines ranges for every 5% increase up to 50% but I'm unable to get my formula to function correctly. I would appreciate any suggestions. My code is below and I do not receive any errors in the formula editor but the formula does not function correctly.

=IF([PERCENTAGE_USED]= "0%" <= "5%";"#FFFFFF"; 
[PERCENTAGE_USED]>= "5%" <= "10.00%";"#FF0000";
[PERCENTAGE_USED]>= "10.00%" <= "15.00%";"#FF4500";
[PERCENTAGE_USED]>= "15.00%" <= "20.00%";"#FFA500";
[PERCENTAGE_USED]>= "20.00%" <= "25.00%";"#FFD700";
[PERCENTAGE_USED]>= "25.00%" <= "30.00%";"#9ACD32";
[PERCENTAGE_USED]>= "30.00%" <= "35.00%";"#ADFF2F";
[PERCENTAGE_USED]>= "35.00%" <= "40.00%";"#32CD32";
[PERCENTAGE_USED]>= "40.00%" <= "45.00%";"#2E8B57";
[PERCENTAGE_USED]>= "45.00%" <= "50.00%";"#228B22";
[PERCENTAGE_USED]>= "50.00%" <= "100.00%";"#008000";
[PERCENTAGE_USED]>= "100.00%";"#006400";) 

Desired result: enter image description here

War es hilfreich?

Lösung

For anyone else that comes across this issue I have included the solution below. There is a great steel-wheels inventory example that is included with the community and enterprise edition that explains how to do this.

=IF( [PERCENTAGE_USED] > 50.0% ; "#339933" ; 
IF( [PERCENTAGE_USED] > 45.0% ; "#00CC00" ;
IF( [PERCENTAGE_USED] > 40.0% ; "#33CC33" ; 
IF( [PERCENTAGE_USED] > 35.0% ; "#66FF66" ; 
IF( [PERCENTAGE_USED] > 30.0% ; "#99FF66" ;             
IF( [PERCENTAGE_USED] > 25.0% ; "#CCFF66" ;
IF( [PERCENTAGE_USED] > 20.0% ; "#FFFF99" ;
IF( [PERCENTAGE_USED] > 15.0% ; "#FFCC99" ; 
IF( [PERCENTAGE_USED] > 10.0% ; "#FFCC66" ; 
IF( [PERCENTAGE_USED] > 5.0% ; "#FFCC00" ;  
IF( [PERCENTAGE_USED] > 0.0% ; "#CD5C5C" ;            
IF( ISNA([PERCENTAGE_USED]) ; "#CD5C5C" )))))))))))) 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top