Counting # displayed groups in report

  • I'm an absolute newbie to Reporting Services and would like to do something I found easy to do in Crystal Reports.

    I want to display only the groups in the report that have at least two detail rows and I want to display the count of these groups at the end of the report.

    Since I didn't find any way to filter out the groups with only one detail row, I used Visibility to hide them. That part works, but I still need to be able to count how many remain visible.

    Does anyone have an approach to this?

  • Use the CountRows() function in the scope of the group you want to count rows for, for example, in a table group footer row add the expression =CountRows()

    If you want all counts at the end of the report, add a list data region at the end of the report, set the details grouping the same as your group for the table, add two text boxes, one containing the field with the group name and the other again with =CountRows()

  • In your query for your dataset, you could probably find a way to use a CTE to create a "groups only" result set (using a HAVING COUNT(*) >1 clause) that could be inner joined to the actual result set on the same fields that appear in the GROUP BY. That would likely eliminate the need to deal with the visibility problem, and then you can use CountRows() as indicated in the other previous post.

    Steve

    (aka smunson)

    :):):)

    John Connell (7/30/2008)


    I'm an absolute newbie to Reporting Services and would like to do something I found easy to do in Crystal Reports.

    I want to display only the groups in the report that have at least two detail rows and I want to display the count of these groups at the end of the report.

    Since I didn't find any way to filter out the groups with only one detail row, I used Visibility to hide them. That part works, but I still need to be able to count how many remain visible.

    Does anyone have an approach to this?

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply