visual-studio-2012reportbuilder3.0reportbuilderreport-builder2.0

Switch with multiple conditions


I have a table where I would like to add some colour to the cells based on the total

    Name     Total
    Alex      12
    Harry      6

Using the following switch statement the 'Total' cell does turn Light Green.

=switch(Fields!Name.value ="Alex" and Fields!Total.value >=11, "LightGreen", Fields!Name.value = "Alex" and Fields!Total.value >=8 and Fields!Total.value <=10, "Orange",  Fields!Name.value = "Alex" and Fields!Total.value <=7,"Red")

However I would now like to make the 'Total' field for 'Harry' to turn Red. I have tried the following but this has not worked

=switch(Fields!Name.value ="Alex" and Fields!Total.value >=11, "LightGreen", Fields!Name.value = "Alex" and Fields!Total.value >=8 and Fields!Total.value <=10, "Orange",  Fields!Name.value = "Alex" and Fields!Total.value <=7,"Red")  or  switch(Fields!Name.value ="Harry" and Fields!Total.value >=11, "LightGreen", Fields!Name.value = "Harry" and Fields!Total.value >=8 and Fields!Total.value <=10, "Orange",  Fields!Name.value = "Harry" and Fields!Total.value <=7,"Red")

Solution

  • Ok managed to answer my own question. I used 'Or' in the second switch statement, swapping this with a comma solved the problem