How do I print an aggregate list of values in a group footer

I have a column in the detail section of the report that flags the rows that meet certain criteria (example: "start date < currentdate").  In the group footer, I need to print the key value of the rows that got flagged or that met the criteria (example: 3557 Olson, 6593 Kent).  If I were doing the report in Crystal, I would create a shared variable that would accumulate the values as the rows were processed.  I don't know how to do a similar function in SSRS.  I wondered about RunningValue or Join but don't think these really apply to this situation.

Example of group contents with last column being the "flag" that indicates rows needing to be in list and the last line in the example being the "running list" I need to return:
Group: MN
2959   Grant   7/20/09    0
3557   Olson   9/15/08    1
3558   Jones  10/30/08   0
6593   Kent     8/15/08    1
6700   Tombs  12/1/08    0
MN Starts = 3557 Olson, 6593 Kent

Who is Participating?
rob_farleyConnect With a Mentor Commented:
Easy to do it in the query using FOR XML PATH('') for string concatenation. Should be doable in SSRS too, but there's no nice concatenation function.

So... if you want to do it in the query, try something like:

select *, stuff((select ', ' + cast( as varchar(10)) + ' ' + from table t2 where = and t2.flag = 1 order by for xml path('')), 1, 2, '') as concatbit
from table t1
order by group

sanw2020Author Commented:
Are you saying that I should create the concatenated string while creating the Data for the report rather that while working on the Layout tab of the report?  Or are you saying that I can create a formula in the group footer section and embed the sql string in the formula?  

Well, I'm saying that you have creating it in the DataSet as an option. I'm not saying you should embed SQL in the formula.

Of course, if SSRS had a concatenate aggregate function, then it would be simple.

sanw2020Author Commented:
Thanks again for your response.  I'll give your suggestion a shot.

I'm surprised that I have only had one responder to this question...  Is this a stupid question?  A very simple/basic question?  Or a very hard question?  

All Courses

From novice to tech pro — start learning today.