Background Color Expression

  • Hello,

    I am trying to code an expression to change the colour of my text box if the value of the cell is above 10%. This field is calculated by dividing two values from the data set.

    iif(Sum(Fields!DNA.Value / Fields!Total.Value) > 0.1,"Red","Green")

    Why does this not work?

    Any help will be appreciated.

    Paul

  • What error do you get?


    I'm on LinkedIn

  • iif(Sum(Fields!DNA.Value / Fields!Total.Value) > 0.1,"Red","LimeGreen") is not a valid color.

    I think there is something wrong with the syntax

  • dramaqueen (7/20/2016)


    iif(Sum(Fields!DNA.Value / Fields!Total.Value) > 0.1,"Red","LimeGreen") is not a valid color.

    I think there is something wrong with the syntax

    The syntax looks okay. What property have you got the expression in? Also, at risk of being patronising, do you have an "=" at the start of the expression?


    I'm on LinkedIn

  • PB _BI touched on this...

    I'm assuming you're attempting to use that expression in a text box properties/color setting... you can put a color or expression in there. if it does not begin with "=" SSRS assumes it's a color. As the error reads,

    iif(Sum(Fields!DNA.Value / Fields!Total.Value) > 0.1,"Red","LimeGreen") is not a valid color.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • Yes sorry I was being really stupid. Makes complete sense.

    Thanks everyone.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply