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

calculating variance of different group values

Status
Not open for further replies.

yehong

Programmer
Sep 22, 2003
291
US
Need help in writing a formula.
Here is what my report looks like:

GroupA
Salary
(sub group) Males $5000
Females $4500
--------------------------------
(Formula)5000/4000=1.25
GroupB
Males $3500
Females $4000

GroupC Males $2000
Females $1500

I am not finding a way to write a formula to divide salary of Males by Females for each group. This formula will be for every Group(i-e GroupA,GroupB, GroupC and so on).
Any idea tips, will be appreciated.
Thanks,
 
Why can't you just reference them in another formula?

Either running totals or manually created formulas can be used to do this.

-k
 
Running total does not seem to fit here. If I want to reference the values in other formula, how can I tell if value is for Males or Females? This is how I am summing up the values for each group.
Sum ({Emp.Salary}, {Emp.Gender})

Now If I had an option like this:
Sum ({Emp.Salary}, {Emp.Gender},"Males") and
Sum ({Emp.Salary}, {Emp.Gender},"Females")
then I would be able to create two formulas and then use my calculation.
thanks
 
A Running Total would do precisely that, in the evaluate use a formula state {emp.gender} = "Males", and reset it at the appropriate level.

Now you can refeence those RT's in a formula.

You could also create your own formulas, as in:

If {emp.gender} = "Males", then
{emp.salary}
else
0

(and one for Females)

You can then sum these and use them in other formulas.

-k
 
I am still not able to calculate Salary for Males and Females into two different formulas by GroupA,B,C,and so on.If I create conditional RT with emp.gender='Males', where do I place it.?
The running total that I created is calculating salary on evaluation of gender='M', then I am reseting it after every group change of GroupA,B,C etc.
 
Ok. it works!. I created two RT's for each gender then placed them in the group footer section of GroupA,B,C,and then used another formula to divide them,and its working fine.

Thanks for your help Vampire!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top