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

Totaling groups 1

Status
Not open for further replies.

EscapeUK

Programmer
Jul 7, 2000
438
GB
I want to be able to add some groups together (but not all off them. See example to see if it is possible. If it is please keep the answer simple

Example

Group 1
Amount 1
Amount 2
Amount 3

Group 2
Amount 1
Amount 2

Total of groups 1 and 2

Group 3
Amount 1

Total of groups 1 and 2 and 3

Group 4
Amount 1
Amount 2

Group 5
Amount 1

Total of group 4 and 5

total of group 1 and 5

Is this possible?

 
The burning question is how do we (and eventually Crystal Reports) know which groups you want added up. Does it alternate (first two, then one)? Or do you want all groups that are divisible by 3 to be by their own? I'm pulling your leg here, but the underlying question needs to be answered. Malcolm
wynden@telus.net
November is "be kind to dogs and programmers" month. Or is that "dogs or programmers"?
 
Let me take a guess here.
Is this by any chane an accounting balance sheet? That 1 and 5 looks like Assets and Equity.

If so, I hope you are using V8, cause you are gonna want to use a several conditional running totals.


Ken Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Well done Ken

So how do I go about this terrible task I have.
 
So, do you have a way to group by Assets/Equity?

Malcolm
wynden@telus.net
 
You will group on account type creating 5 groups in the report. You will create any single group subtotals that you need and place them in the group footer.

Now you need 4 running totals to do the Multi-Group totals. Each will sum the amount field, but they will use a different "evaluate" formula. Crystal allows you to increment a running total using only records that meet a formula condition. So the first running total will have a condition like:

{Group} = 1 or {Group} = 2

The second running total condition will be:

{Group} = 1 or {Group} = 2 {Group} = 3

Now Place each of these running totals on their own private group footer subsections (ie GF1a, GF1b, etc) and format these subsections to be suppressed unless they are the GF for the one group that should be followed by this running total. In other words the second running total might go in GF1C, which would only print at the end of the third group. So the suppress formula for that subsection would say:

Group <> 3

This suppresses the Footer on each group except number 3, printing this total at the correct point in the report.

Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Great but i have one morw problem i need to subtract the values held in to group totals. for example Group 1 - group 2
 
To add to the above comment, I have a cost of sales group total and a income total. If the figures are negative in both eg... Sales Income Total -300 and the costs of sales income total = -100 i want the total to be -200.

Where as if the Sales in come is -500 and the cost of sales is 100 i want the total to be -400
 
You should be able to create two more conditional running totals. One for Group 1, the other for Group 2. Then Subtract one from the other (or add them together) in a separate formula. As long as you display this formula only after both groups are complete, you should get the net you are looking for. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Thanks Ken

So how is that you know so much about Crystal. I know you are a trainer you must have been doing it for a far amount of time.

 
Escape,

Well, ahem, since you asked ... Crystal is all I have been doing for the past 5 years, with another 5 before that working with a similar reporting tool (R&R). I teach classes using course material that I wrote from scratch. That pushes me to explore all of the dusty corners of the product.

I also do consulting and write reports for people, which is why I recognized the Financial pattern you presented. I had to write a similar report once using an old version of Crystal that required coding all of these running totals by hand. It had columns for budget, actual, prior year, variances .... what a nightmare.

Anyway, glad to help. Drop by my web site sometime for some other interesting Crystal tidbits. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top