DiningPhilanderer
DiningPhilanderer

Reputation: 2767

SSRS 2005 - Running Group Count

How do you you display the running GROUP count via SSRS 2005?

I have a report that has n groups where the source data must remain anonymous and I want that number in the header of the group...

So instead of the name in the group header like such...
Employee - John Smith
Employee - Mary Swain
...
Employee - Ahmad Sal

I want...
Employee #1
Employee #2
...
Employee #n


Thanks!!!

Upvotes: 6

Views: 19630

Answers (4)

Doug
Doug

Reputation: 83

I know this is super old, but I'm sharing this for anyone having the same problem.

It depends on your table and the level of grouping. For example, let's say I have a Details group and two parent groups called "Parent" and "Child".

Parent{
    Child{
        Details group{

Using just the "RowNumber" function will only return records from a Details group, not from a Row Group. Riegardt was very close, however, even this doesn't account for the level of grouping or null ("Nothing"). If this was to be applied to the group called "Child" in the structure I mentioned above, this wouldn't work. Also, The count would potentially be inconsistent if there were records in the column with a null ("Nothing") value. "Count" and "CountDistinct" start their count at zero for null values and one for non-null values (this applies to the "RunningValue" function's parameter as well). The solution is to include ALL parent groups above the current group you're counting and to not even allow the value from a column to return null in the first place. Here's my solution:

Row Groups within a parent Group:
=RunningValue(IIf(IsNothing(Fields!ParentFieldValue.Value), "", Fields!ParentFieldValue.Value).ToString & IIf(IsNothing(Fields!ChildFieldValue.Value), "", Fields!ChildFieldValue.Value).ToString, CountDistinct, Nothing)

Row Groups with no parent Group:
=RunningValue(IIf(IsNothing(Fields!ParentFieldValue.Value), "", Fields!ParentFieldValue.Value).ToString, CountDistinct, Nothing)

Upvotes: 1

Riegardt Steyn
Riegardt Steyn

Reputation: 5701

=RunningValue(Fields!Employee.Value, CountDistinct, Nothing)

Voila!

Upvotes: 22

DiningPhilanderer
DiningPhilanderer

Reputation: 2767

OK, I have a workaround that only is valid because the number of rows is constant for each group.

=(RowNumber("table2"))/(RowNumber("table2_Group1"))

This will work for the scope of this report, but it still seems like there should be an easier way...

Upvotes: 0

IMHO
IMHO

Reputation: 799

Use

RowNumber("table1_Group1")

Upvotes: 3

Related Questions