问题
I have a ssrs table report with row grouping and I would like to know how to change the colours of rows in groups without changing the background colour of the group column itself. With the answers I have found and implemented I get the effect of the second table in the picture when I want the effect of the first table:

Any help will be much appreciated.
This is a picture of the actual report and it's grouping:

回答1:
The RowNumber technique only works on the Details group i.e. the lowest level group (with no Group columns defined). Think of it as returning the Row in the Dataset.
Instead I would write an expression that calculates the equivalent to RowNumber, but for the Group level - typically something using RunningValue ... CountDistinct
on the Group Key field, like this:
= Iif ( RunningValue ( Fields!tableid.Value , CountDistinct , "TheNameOfYourGroup") Mod 2 = 0, "White", "WhiteSmoke")
回答2:
I need to apply the alternation to all rows including Total rows so:
'define Report Variables: ActiveRowColour, ColourA, ColourB
'Call this function in one cell per row by setting => BackgroundColor=Code.NewActiveRowColour(Variables!ActiveRowColour.Value)
'Then All other cells on that row set -> BackgroundColor=Variables!ActiveRowColour.Value
Public Function NewActiveRowColour(ByVal sActiveRowColour As String) As String
If sActiveRowColour = Report.Variables!ColourA.Value Then
Report.Variables!ActiveRowColour.Value = Report.Variables!ColourB.Value
Return Report.Variables!ColourB.Value
Else
Report.Variables!ActiveRowColour.Value = Report.Variables!ColourA.Value
Return Report.Variables!ColourA.Value
End If
End Function
来源:https://stackoverflow.com/questions/24011213/ssrs-alternating-row-colour-within-groups