简体   繁体   中英

SSRS Change cell color depending on SUM value

I am loading a dataset into my report and filling my last column with this expression: =Sum(Fields!ID.Value) and it loads fine, I am trying to put a condition in so when the number is less than 15 for example, the cell color will change to red. I have tried so many different syntax but nothing works... it must be pretty simple...? The errors I am getting are: The value expression for textbox has scope parameter that is invalid for aggregate

Any help would be good :)

To set the background color Click on the cell and in properties window on your right hand select the BackgroundColor property and then set expression to that property.
Or right click on cell and select TextboxProperties -> Fill and at the start there is option to set the expression for fill color. You are using the wrong expression the expression should be ,

  = IIF(Sum(Fields!ID.Value) < 15,"Red","Transparent")

You can change the Transparent to whatever color you want. Take a look here on how to use expressions .

This shows how you could add a colour range if necessary by using the Color property to set the font colour.

=iif(Sum(Fields!ID.Value) < 15,"Red",iif(Sum(Fields!ID.Value)>50,"Blue","Black"))

To Change the background colour instead you would use the Background colour property.

 =iif(Sum(Fields!ID.Value) < 15,"Red", "No Color")

Note that SSRS 2008 "Transaparent" is replaced by "No Color". Whilst transaparent works it gives rise to this warning message.

[rsInvalidColor] The value of the BackgroundColor property for the textbox 'textbox22' is “Transparent”, which is not a valid BackgroundColor.

As an alternative to these use "#FFFFFF" instead of Transaparent or No Color

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM