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!

subtotals 2

Status
Not open for further replies.

moonknightt

Programmer
May 7, 2002
92
0
0
US
I have a report that is in this format

orgid ClientNumber client amount
6 1 $2000
6 2 $6000
6 3 $8000
6 4 $3655
6 5 5635
6 6 $8000
6 7 $10000
6 8 $9700
6 9 $5988
6 10 $300
6 11 $82555

I need to take the sum of the first 5 and then the sum of the rest of them sothat the report looks like this

orgid ClientNumber client amount
6 1 $2000
6 2 $6000
6 3 $8000
6 4 $3655
6 5 $5635
total of first 5 $25290
6 6 $8000
6 7 $10000
6 8 $9700
6 9 $5988
6 10 $300
6 11 $82555
total of rest $116543

Please Does anyone know how i could get this done


 
Try a RunningTotal.

Get it to sum the $ value and to reset using a formula;

Remainder({$Value},6)=0

I haven't had time to test it further than the number of records you supplied but it should start you off on the right track.
 
thank you but how do i get it in this format
orgid ClientNumber client amount
6 1 $2000
6 2 $6000
6 3 $8000
6 4 $3655
6 5 $5635
total of first 5 $25290
6 6 $8000
6 7 $10000
6 8 $9700
6 9 $5988
6 10 $300
6 11 $82555
total of rest $116543

since each client number can have different amounts in the detail like this

orgid ClientNumber client amount
6 1 $2000
6 1 $6000
6 1 $8000
6 1 $3655
6 1 $5635
6 2 $8000
6 2 $10000
6 2 $9700
6 3 $5988
6 3 $300
6 3 $82555
6 1 $2000
6 1 $6000
6 1 $8000
6 1 $3655
6 1 $5635
6 2 $8000
6 2 $10000
6 2 $9700
6 3 $5988
6 3 $300
6 9 $82555
6 9 $2000
6 8 $6000
6 8 $8000
6 8 $3655
6 8 $5635
6 8 $8000
6 8 $10000
6 7 $9700
6 7 $5988
6 7 $300
6 7 $82555
6 6 $2000
6 6 $6000
6 6 $8000
6 6 $3655
6 5 $5635
6 5 $8000
6 5 $10000
6 4 $9700
6 4 $5988
6 4 $300
6 4 $82555

total of rest $116543
 
You should use a TopN summary function for this.

Alternatively, you could use a formula in the details section like:

WhilePrintingRecords;
NumberVar X;
NumberVar Y;

If RecordNumber < 6
Then X := X + {Customer.Last Year's Sales}
Else Y := Y + {Customer.Last Year's Sales};

Display X in a conditionally suppressed group footer, and Y in the report footer.

Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top