Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 fill color expression

Author  Topic 

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-05-18 : 02:32:24
hey all,

so i have a report and in one coloumn I want to colour code it.
in the current column I have the following expression:
=iif(Fields!Sales.Value=0,"",iif(Fields!Sales_Last_Year.Value=0,"",(Fields!Sales.Value/Fields!Sales_Last_Year.Value)-1))

now in the color fill box I have this expression:
=iif(me.value>0,"LightGreen",iif(me.value<0,"Tomato","LightGrey"))

I want the cell to be shaded grey if there is nothing in the cell, green if the value is positive and red if the value is negative.

currently the numbers will go red and green. but where there is no value it remains a no fill color. I want it to turn grey.

I have also tried:
=iif(me.value="","LightGrey",iif(me.value>0,"LightGreen","Tomato"))

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-05-18 : 02:36:59
to put it simple
I have the following cell values and want to shade them in the following colors:
15% (positive, shaded green)
-3% (negative, shaded red)
"" (which is nothing, shaded grey)
33% (positive, shaded green)
12% (positive, shaded green)
-4% (negative, shaded red)

in the fill expression window I have tried this:
=iif(me.value>0,"LightGreen",iif(me.value<0,"Tomato","LightGrey"))

only the green and tomato work, not the grey

and
=iif(me.value="","LightGrey",iif(me.value>0,"LightGreen","Tomato"))
this does nothing.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-19 : 15:03:39
=iif(me.value Is Nothing,"LightGrey",iif(me.value>0,"LightGreen","Tomato"))

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

pavlos
Yak Posting Veteran

59 Posts

Posted - 2012-05-20 : 20:26:26
awesome! thanks!
i also need to re-assign my original text box expression to = nothing and not = ""
Go to Top of Page
   

- Advertisement -