Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running total on 1

Status
Not open for further replies.

peterlum

Programmer
Oct 26, 2007
6
US
Hi
Im trying to get a count to carry over from month to month so theres a running total within the PERSON group but im having trouble since the count resets every PERSON.
kinda like so
DETAILS: [value]
MONTH
PERSON.1 COUNT of(value)
PERSON.2 COUNT of(value)
TOTAL X
MONTH //want this to happen
PERSON.1 COUNT of(value) + previous months count..ect
PERSON.7 COUNT of(value)
TOTAL X

Im pretty new to CR and i apologize if this is a simple or poorly explained question but for the life of me i cant figure this out. ne help would be appreciated
 
This is not simple to do. Your best bet might be to insert a subreport that is linked on the person field and on the date field, but then go into the subreport record selection formula and change it to:

{table.date} < dateserial(year({?Pm-table.date}), month({?Pm-table.date})+1,1) and
{table.person} = {?Pm-table.person}

-LB
 
hey thanks for the reply lbass. gave your suggestion a shot but i think im still too noobish to apply your method sucessfully.

I was thinking if there were a way of dynamiclly creating a numVar name to the PERSON and have that value sumed on month to month but when i try:
numberVar {Survey_Letter.Person} := 0;
or Cstr it i get a 'variable name expected here' error or 'does not appear to be part of the formula'. thanks again.
 
20 people but not everyone has counts every month so there would probably have to be some conditional logic in there.
 
I still think you should try the subreport. In the main report, you have a group#1 on {table.date} on change of month and a group on {table.person}. Insert a subreport that uses the same tables, and add the field you want to count to the detail section of the sub. Then right click on the field and insert a count at the grand total level. On the link tab, choose {table.date} and {table.person} as links and link them to the corresponding fields in the subreport. Place the sub in the GH#2.

Then right click on the subreport->edit subreport->report->selection formula and change the formula to:

{table.date} < dateserial(year({?Pm-table.date}), month({?Pm-table.date})+1,1) and
{table.person} = {?Pm-table.person}

Just substitute your actual date and person fields in the above formula. Then suppress all sections of the subreport except the report footer.

-LB
 
it worked! many thanks lbass. that formula looked a bit daunting at first but it makes perfect sense now. thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top