Search code examples
reporting-servicesssrs-2008ssrs-2008-r2ssrs-2012ssrs-tablix

expression in cell only works 3/4 of the time


I have the following expression in my background color property of my data cell for my matrix report.

If the value in the cell is a "0", then the cell color should be Red. Other wise it is alternating between Blue and White.

I'd say it works on 75% of my cells. But sometimes, a cell with a "0" will be white or blue.

I can't find any rhyme or reason for it.

=iif(Sum(Fields!Total_Logged.Value)=0, "Red", iif(RunningValue(Fields!UserName.Value,CountDistinct,Nothing) Mod 2, “Blue”, “White”))

Is there a better way of doing this?

Thanks!


Solution

  • This will help if Total_Logged has NULL values.

    =IIF(IIF(IsNothing(Sum(Fields!Total_Logged.Value)), 0 , 
        Sum(Fields!Total_Logged.Value)) = 0, 
        "Red", IIF(RunningValue(Fields!UserName.Value,CountDistinct,Nothing) Mod 2,
        “Blue”, “White”))