Print Page | Close Window

SUM by group

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17927
Printed Date: 02 May 2024 at 12:52am


Topic: SUM by group
Posted By: MikeTex
Subject: SUM by group
Date Posted: 05 Nov 2012 at 11:46am

I have a question that I need help.
I have a report that contains 3 groups:
1st Group -> Account
2nd Group -> Account Like'6*'
3rd Group -> Account Like'7* '
The 2nd group footer gives me a sum for each account started by '6'
The 3rd group footer gives me a sum for each account that begins with '7'

I need to get the report the way you describe:
2nd Footer Account Like'6 * 'containing the sum of all footers account Like'6 *'
3rd Footer Account Like'7 * 'containing the sum of all footers account Like'7 *'

For now exemplified what I'm getting.

61 - 500.00
Total - 1000.00
62 - 250.00
Total - 1000.00
69 - 250.00
Total - 1000.00

What I need is:

61 - 500.00
62 - 250.00
69 - 250.00
Total - 1000.00
71 - 1000.00
73 - 500.00
78 - 500.00
Total - 2000.00

Grand Total - 3000.00



-------------
Mike Teixeira



Replies:
Posted By: DBlank
Date Posted: 05 Nov 2012 at 1:58pm
Create a formula field to group on and then insert a sum at the group level and another at the report footer level.

Your formula for grouping will depend on the field type of the "numbers".
If field like '6*' then '6x' else
if field like '7*' then '7x' else 'other'


Posted By: MikeTex
Date Posted: 06 Nov 2012 at 7:22am
Thank's DBlank,
 
I have already a field to group the numbers, my problem is only:
 
The data that starts with 6 is grouped correctly;
The data that starts with 7 is grouped correctly;~
 
But i can't Sum each group like this:
 
Group '6*'
SUM Group '6*'
 
Group '7*'
SUM Group '7*'
 
Grand Total ('6*'+'7*')


-------------
Mike Teixeira


Posted By: DBlank
Date Posted: 06 Nov 2012 at 8:06am
just click on the field you want to sum
click on the sigma sign (blue E)
select the type as a sum
select the location as the group footer
it will create a summary that wikl appear on the group footer
This will only sum rows that fall into each group
the formula looks like this
SUM({table.value},{table.groupfield})
 
repeat the process for the grand total
it will palce the summary in the report footer
the formual look like
sum({table.value})



Print Page | Close Window