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

Running Totals 1

Status
Not open for further replies.

report2000

Technical User
Mar 1, 2005
45
US
Hi,
I am trying to use runningTotal field feature in crystal reports to calculate "Weighted Average" for a set of datas.
The RunningTotal wizard tool lets me only to select the following fields:
(1) Field to Summerize - AverageHourlyPay
(2) Type of Summary - Weighted Average
(3) with - NumberofEmployees

The formula to calculate the Weighted average is the following:(Based on the requirement's guideline)
sumofthe(AverageHourlyPay*NumberOfEmployees)/SumOfNumberOfEmployees

I tried to write two functions to calculate the first part of formula and the second. Then use the unningTotal field feature in crystal reports to calculate the weighted average. (Not successful - Doesnot allowed to bring in funtions into the fields).

Thank you
 
You don't need, nor will you be able to use the Running Total Weighted Average.

Use the function itself in a formula. Here's the Crystal help example:

Examples
The following example is applicable to both Basic and Crystal syntax:

WeightedAverage({table.FIELD1}, {table.FIELD2})

Returns 3.5, where the two fields have four values each. Field1 has values of 3, 2, 5, and 1. Field2 has values of 0, 1, 1, and 0. WeightedAverage calculates as follows: (3*0 + 2*1 + 5*1 + 1*0)/sum{table.FIELD2}) = 3.5.

Unfortunately you might run into fiddiculties when trying to preform summaries upon summaries.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top