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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manual Running Totals - Grouping causes incorrect totals

Status
Not open for further replies.

ToastyinVA

Programmer
Sep 27, 2000
16
0
0
US
Crystal 8

I am using a manual running total to count unique account numbers - this works fine at the detail level. When I group by account number and place the running total in the footer I noticed my count was off. Whenever there is a record with only 1 account number to group the group footer is adding 2 to the count.

WhilePRINTINGRecords;
NumberVar RetailLeaders2;

If ( onfirstrecord OR ({IS4830_POP_REPORT_VOLUME.RTL_ACCOUNT_NO} <>
Previous({IS4830_POP_REPORT_VOLUME.RTL_ACCOUNT_NO}) )
then
(RetailLeaders2 := RetailLeaders2 + 1 ;)
else
(RetailLeaders2 := RetailLeaders2 + 0;)



For example

account running total at the detail
A 1
A 1
A 1
B 2
C 3
C 3
C 3

account running total at the group level (account)

A 1
B 3
C 4

Why does Crystal do this? I cannot use the Distinct count function in this report because I will need to do about 10 of them (based on different conditions) and the performance time will be terrible so I need to create manual running totals

Please Help - I've spent 4 days on this already!

 
You have to have initialize your count first.

ie. NumberVar RetailLeaders2:= 0;
 
I did initialize the variable in another group header. Not initialzing it would not cause the error I see
 
I did initialize the variable in another group header. That is not the problem (but thanks)
 
I thought I could do this with manual running totals but I cannot figure out why crystal burps on the group footer. I can get this to work if I use the running total wizard, do a &quot;count&quot; on account number and then in the evaluate part put the (onfirstrecord or previous(account) <> account)....this works so I will use it. I gave up trying to figure out what crystal was doing when I tried manual counts. I wasted 4 days on this already. Urgg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top