0

I have a report in SSRS and I am trying to change the background color based on a group. I have 3 groups: YearMonth, Portfolio, and Name. I want to change the color of every other portfolio group. Inside each portfolio group I want all rows to be the same color.

I have tried the following expressions and it fails when there are odd number of portfolios in a given month, ie I don't want the same colors touching.

=IIF(RunningValue(Fields!Portfolio.Value, CountDistinct, "MonthYear") Mod 2, "Gainsboro", "White")

The above gets:

YearMonth   Port# (Color)
Sep-11      Port1 (Gainsboro)
            Port2 (White)
Aug-11      Port1 (Gainsboro)
            Port2 (White)
            Port3 (Gainsboro)
Jul-11      Port1 (Gainsboro)

I want:

YearMonth   Port# (Color)
Sep-11      Port1 (Gainsboro)
            Port2 (White)
Aug-11      Port1 (Gainsboro)
            Port2 (White)
            Port3 (Gainsboro)
Jul-11      Port1 (White)
KreepN
  • 8,528
  • 1
  • 40
  • 58
buzzzzjay
  • 1,140
  • 6
  • 27
  • 54

1 Answers1

2

To me it would seem that you want it to alternate colors based on group, but have it take into consideration the color of the last line in the prior date.

Seeing as how this is the case, why not just select the row itself (that handles the groupings)(far left portion of the yellow box). You can then select the BackgroundColor property and choose "Expression"

enter image description here

You should be able to input something like:

= IIf(RowNumber(Nothing) Mod 2 = 0, "Silver", "Transparent")

This will get you alternating colors as you have described.

KreepN
  • 8,528
  • 1
  • 40
  • 58
  • That's not what I am looking for. I wanting alternating colors by groups with everything inside the group being the same color. The expression I used above get this mostly, but it messes up where their are an odd number of groups. – buzzzzjay Oct 10 '11 at 13:37
  • = IIf(RowNumber(Nothing, "MyGroupName") Mod 2 = 0, "Silver", "Transparent") – Jamie F Oct 10 '11 at 13:51