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

Calcuating Sub-Total

Status
Not open for further replies.

1cutedimple

Programmer
Feb 27, 2004
11
0
0
CA
Hello,
I have a report with a list of people grouped by division they belong to.

1.I have a formula that counts the # of deals for each person.
Count ({Q1_Ins_Tbl.Life_Ins}, {Q1_Ins_Tbl.Name})


2.Within the deal, a person could have sold an insurance sale. Each sale is identified by a different code: J, S or N. This is the formula I have to count the # of J's and S's, and to get the total # of sales:
If {Q1_Ins_Tbl.Life_Ins}="J" then 1 else 0 (@JCount)
If {Q1_Ins_Tbl.Life_Ins}="S" then 1 else 0 (@SCount)
Sum ({@JCount}, {Q1_Ins_Tbl.MS_Name}) + Sum ({@SCount}, {Q1_Ins_Tbl.MS_Name}) (@Ttl Life Ins)

3.Another formula is used to calculate a percentage of # of sales vs. # of deals, called Pene Rate:
{@Ttl Life Ins} % Count ({Q1_Ins_Tbl.Life_Ins}, {Q1_Ins_Tbl.Name})

4. Another formula will tell me if the person is qualified for a bonus, based on if Pene Rate is high enough, called Qualified:
if {@Pene Rate} >= 57 then "Y" else "N"

5. Lastly, a formula that will calculate the dollar bonus: if {@Qualified} = "Y" then
{@Total Life Insurance} * 25
else 0

What I need now is a sub-total that will give me the total payout for each division for ONLY the people who were qualified to receive the bonus.

What should I do?
 
It's unclear what problem you are running into. Are the values in step 5 correct? If the issue is that you want to sum the results of {@bonus} (your step 5 formula), but can't because it contains summaries, then you can use variables. Create three formulas:

//{@reset} to be placed in the division group header:
whileprintingrecords;
numbervar divsum := 0;

//{@accum} to be placed in the section containing {@bonus}:
whileprintingrecords;
numbervar divsum := divsum + {@bonus};

//{@display} to be placed in the division group footer:
whileprintingrecords;
numbervar divsum;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top