Search code examples
reporting-servicesssrs-2008

Always shade first row of the detail group in SSRS 2008


Can anyone please advise on any expression that I can use to always shade the first row of the detail group and then alternatively shade the remaining rows?

For example below is my tabular report and what I would like to achieve is always shade the row that appears immediately after GroupHeader. It should always shade row number 13 and then every alternative row after that.

enter image description here

This is the expression that I already have in place for the background color of the detail row=IIF(RunningValue(Fields!DetailRowIdNmb.Value, CountDistinct, "MainGroup") Mod 2 = 0, "White", "Grey").


Solution

  • Make sure that the scope you used, 'MainGroup' is the name of the row group that does the grouping shown on rows 10 and 12. You also don't need to do a distinct count as you may have duplicates, simply use

    RunningValue(1, Sum, "myScopeName")

    Then it should work.

    Note Its better to use Nothing rather than "White" if you are trying to make the background have no colour. Also It's "Gray" not "Grey"

    I just did a quick test using a table containing counties and continents and it worked as expected. My expression looks like this..

    =IIF(RunningValue(1, Sum, "ContinentDesc") Mod 2 = 0, Nothing, "Gray")
    

    If you have issues, try adding a new column to the end of the table and setting its expression to your RunningValue expression (=RunningValue(1, Sum, "ContinentDesc")) . This should start counting from 1 again at the start of each group. I've illustrated below.

    enter image description here