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

Not able to summarize a formula

Status
Not open for further replies.

arodri

Technical User
Jul 9, 2010
121
US
Hello,

I have a formula that I need to summarize, but crystal reports will not allow me to do this. It says that it cannot be summarized. I have no subreports, but from my research online it seems that I may have to use shared variables? I've never used them before so I'm not sure where to start with that.
My report has 3 groups (region, site, and employee), all in that order, and I'm my data source is a stored procedure created in sql server.

My formula that I need to summarize is:
@Bonus =
Code:
 IF {Commissions.Region} = "TX - El Paso" 
THEN
(IF (sum({Commissions.revenue_actual},{Commissions.SITE}))>={@RevenueGoal} and 
{@TotalBase}> 50 THEN 50 ELSE 0)
Else 
IF sum({Commissions.UWCSignupActual},{Commissions.SITE}) >= {@SignupGoal} 
AND
sum({Commissions.PPDRevenueActual}, {UCommissions.SITE})>= {@RevenueGoal}
AND
{@TotalBase}>50
THEN 50 
ELSE 0

I place this formula in the employee group(group#3) FOOTER. so I have a list of emplyees for each site, and they get $50 if certain conditions are met, so this part is working fine. What I need is a total (which is going to go in the site (group#2) FOOTER) for these bonuses. I would like to just sum(@50Bonus) if possible. Is there any way that I can do this with what I have?

Thanks!
 
Use a variable in three formulas:

//{@reset} to be placed in the GH2:
whileprintingrecords;
numbervar sitesum;
if not inrepeatedgroupheader then
sitesum := 0;

//{@accum} to be placed in the GF3:
whileprintingrecords;
numbervar sitesum := sitesum + {@50Bonus};

//{@display} to be placed in GF2:
whileprintingrecords;
numbervar sitesum;

If {@50Bonus} is a currency, change the numbervar in all three formulas to currencyvar.

-LB
 
Thanks lbass!

This was a HUGE help - it accomplished exactly what I needed it to. You saved me so much time!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top