Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Grouping & Section Totals Post Reply Post New Topic
Author Message
trims30
Newbie
Newbie


Joined: 26 May 2012
Online Status: Offline
Posts: 3
Quote trims30 Replybullet Topic: Grouping & Section Totals
     Posted: 26 May 2012 at 2:27am
I'm new to crystal reports and need help formatting a report.
My Data is shown below.

Rules are:
Records are sorted by Account
Type 1 Accounts are Headings and contain no Dollar Amounts
Type 2 Accounts are the only accounts that can have Dollar Amounts
Type 3 thru Type 9 Accounts are group totaling accounts - they will display a total of all preceding accounts of a lower type.

Is this possible to do with Crystal?  I need some guidance.

Hope someone can help.

Lee



My Data



Group A total is sum of preceding type 2 accounts
Group B total is sum of preceding type 2 accounts but not including Group A
Section Total (Account 300) is total of all preceding accounts of a lower type

Same applies to Group C and Grand Total.

Here's the Result Desired


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 May 2012 at 3:45am
You can create a formula field to group the accounts togther and from there just do a sum on the amount field
Your grouping formula could be
floor({table.account},100)
 
 
or you can use a running total (or shared variable formulas) to get the total value
IP IP Logged
trims30
Newbie
Newbie


Joined: 26 May 2012
Online Status: Offline
Posts: 3
Quote trims30 Replybullet Posted: 29 May 2012 at 4:50am
I have no idea as to what the account numbers are.

All I know is that I need 7 total accumulators (3,4,5,6,7,8,9) all set to Zero at start of report.

As each type 2 account is reported, it's value is added to all 7 accumulators.

When a type 3 thru 9 account is detected, the account is printed along with it's corresponding accumulator and then that accumulator and all accumulators of a lower type are reset to Zero and running totals are maintained by all higher numbered accumulators till reported.

This is part of a user defined report with group totals controlled by the data itself.


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 May 2012 at 5:12am

So your Account Number field was just inserted to show but does not exist in the DB?

I really do not like to rely on the order of the data coming into the report and not being altered but if you have no choice...
You can use 2 running totals
1 for the sub totals and 1 for the grand total
 
RT1
name= Sub total (or whatever)
field to summarize=amount
type=sum
evaluate= for each record (unless your types<>2 also have values in them that you are not showing in your example data)
reset=use a formula
table.type=1
 
RT2
name= Grand_total (or whatever)
field to summarize=amount
type=sum
evaluate= for each record (unless your types<>2 also have values in them that you are not showing in your example data)
reset=never
IP IP Logged
trims30
Newbie
Newbie


Joined: 26 May 2012
Online Status: Offline
Posts: 3
Quote trims30 Replybullet Posted: 29 May 2012 at 5:48am
Account numbers are in Database and report is sorted by account numbers.
I have no idea as to what account numbers will be except they are numeric.
The Type 1 accounts are optional and I can't rely on them being there.

I will work with your suggestions and see what I can come up with.

Thanks

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 May 2012 at 6:02am
if the account numbers are there and alwasys follow the rules of staying withing the 100 value then the
floor(table.account#,100) would allow you to figure out which ones are 'grouped' together
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum