Adding more then 2 conditionals formatting into a field (Report Builder 3.0)

  • Hi Guys,

    I am trying to add more then 2 conditionals into a field. To be more specific i well write the current expression:

    Current expression:

    =IIF(Sum(Fields!Diff_CY_Tot_LY_Tot_Sales_Comm.Value, "Overview2")>0, "LimeGreen","Red")

    You can see at the current situation that the field can be changed in only 2 colors. Does anyone know how to add more colors based on the fields?

    For example:

    IF x = 0,1 THEN change the background color of the field into WHITE

    IF x => 0,1 THEN change the background color of the field into GREEN

    IF x < 0,1 THEN change the background color of the field into RED

    As you can see in the example there should be 3 conditionals in one Expression.

    I am trying to make this report in Report Builder 3.0 i also have visual studio 2008.

    Thanks for reading this topic.

    Eidjaz

  • I think i found the solution.

    Solution:

    A different way to get the same functionality uses the Switch function. The Switch function is useful when you have three or more conditions to test. The Switch function returns the value associated with the first expression in a series that evaluates to true:

    Copy Code

    =Switch(Fields!PctComplete.Value >= 10, "Green", Fields!PctComplete.Value >= 1, "Blue", Fields!PctComplete.Value = 1, "Yellow", Fields!PctComplete.Value <= 0, "Red",)

    Source: http://technet.microsoft.com/en-us/library/ms157328.aspx

  • Although you've figured out the right command, your results won't be as expected.

    It will never turn yellow when Fields!PctComplete.Value = 1 but it'll be blue 🙂

  • Also you will have no specifically assigned color, therefore the default color, when your value is greater than zero but less than 1.

Viewing 4 posts - 1 through 3 (of 3 total)

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