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

Percentages on Group Sums 1

Status
Not open for further replies.

prl423

IS-IT--Management
Feb 28, 2006
13
US
I am wanting to do a percentage on sums in a group. I have multiple groups, that have sums (subtotals) within those groups. Right now I only have percentages at the end of my report. Example: Sum ({ARCUSFIL_SQL.amt_age_prd_1}) % Sum ({ARCUSFIL_SQL.balance}) How do I tell Crystal 8.5 I want to perform a calculation on sums that are scattered throughout the report. Thanks in Advance
 
Do a running total that is cleared foe the group. I used them regularly when we were on 8.5.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You'll need to create formulas for each Group Level where you want the percentages.
There's nothing in Crystal that'll do this automatically.
Don't forget to check for 0.
Code:
Local NumberVar n := Sum({ARCUSFIL_SQL.amt_age_prd_1},{Table.GroupingField}) ;
Local NumberVar d := Sum ({ARCUSFIL_SQL.balance},{Table.GroupingField}) ;
If d <> 0 then n % d

Bob Suruncle
 
You could use:

Sum ({ARCUSFIL_SQL.amt_age_prd_1},{table.group1field}) % Sum ({ARCUSFIL_SQL.balance},{table.group1field})

For each group level, you would have to substitute the correct group field in the group condition parts of the formula.

-LB
 
Need to take this one step further I guess, should have explained this a bit further the first time....How would this formula look when the subtotals occur within a group that is within another group........ex. group level is CDN or Canadian and then within another group called WIC? Within the WIC group is where the subtotals are located. Thanks for the help, greatly appreciated.
 
Just change the group condition to match the group. Something like:

Sum ({ARCUSFIL_SQL.amt_age_prd_1},{table.WIC}) % Sum ({ARCUSFIL_SQL.balance},{table.WIC})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top