Search code examples
ssrs-2008reporting-services

SSRS customized bar chart color


I've to show colors depending of the percentages of each bar in my chart report. I'm using a expression in a "Series Properties"

=IIf (Fields!TotalComplete.Value / Fields!TotalJobs.Value <= 85, "Red",
IIf (Fields!TotalComplete.Value / Fields!TotalJobs.Value >= 97, "Green", "Orange"))

But all bar are showing in Red color

What I'm setting bad?

Thanks,
Eliana


Solution

  • I think your problem is that you are comparing to 85 and 97 when you probably ought to be comparing to .85 and .97. Also, you need to work with aggregate values, like this:

    =iif(sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value) <= .85, "Red", iif(sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value) >= .97, "Green", "Orange"))
    

    If that doesn't solve the problem, try creating a table using the same groupings you have for your chart and put this expression into a text box so that you can see what value is calculating:

    sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value)