Description
Enables you to calculate the weighted average of the specified fields.
Overloads
WeightedAverage (fld, fld)
WeightedAverage (fld, fld, condFld)
WeightedAverage (fld, fld, condFld, cond)
Arguments
fld is any valid numeric database or formula field that can be evaluated by the function.
condFld is a field used to group the values in fld by.
cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see
Conditions for summary functions.
Action
Enables you to calculate the weighted average of the specified fields. When you calculate a weighted average, you are actually calculating the average of one field and then using the values in another field to "weigh" the contribution of each value in the first field to the average. In a normal average, all the weights are equal to 1.
For example:
You can calculate the weighted average of two fields.
You can calculate the weighted average of two fields, for all the values within a group (for example, sales grouped by the state that they come from).
You can calculate the weighted average of two fields, for all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made).
Examples
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.
Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the
Evaluation Time.