SSRS 2005 - Running Group Count
Asked Answered
A

4

6

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!!!

Austronesian answered 12/5, 2010 at 13:56 Comment(0)
G
3

Use

RowNumber("table1_Group1")
Gloam answered 12/5, 2010 at 14:2 Comment(1)
If you put it in detail row - it will return current rowGloam
R
22

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

Voila!

Roundy answered 14/12, 2010 at 14:41 Comment(2)
This is good for a constant number per group. Example if there are 3 in group1, it will show 1 1 1 if 5 for group2, it will show 2 2 2 2 2 etc. What I'm still looking for is a ROWCOUNT per group. So using the example above it will show: Group1 1 2 3 Group2 1 2 3 4 5 etc.Carolinian
Thats the correct answer! You should provide more details e.g. right click on row --> row preferences --> visibility --> expression --> your codeSang
G
3

Use

RowNumber("table1_Group1")
Gloam answered 12/5, 2010 at 14:2 Comment(1)
If you put it in detail row - it will return current rowGloam
T
1

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)
Threonine answered 26/5, 2022 at 5:34 Comment(0)
A
0

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...

Austronesian answered 12/5, 2010 at 14:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.