Search code examples
reporting-servicesssrs-2008ssrs-2012

Switch with an aggregate function


I have the below table, the Total Is derived from a count expression,

=count(fields!Total.value)


Department        Total
HR                 50
H&S                60
Data               90

I would like to add some background colour dependent on the values in the total column. For example anything less than 49 would be red anything greater would be green.

I have tried the following (ABC - being the dataset)

=switch(count(fields!Total.value <= "49", "red"),"ABC")

I get the error the scope parameter is not valid for an aggregate function


Solution

  • the syntax looks off.. should it not be

    =switch(count(fields!Total.value) <= 49, "red", True, "green")
    

    IIF would make more since if its just 2 options

    =iif(count(fields!Total.value) <= 49, "red", "green")