Crystal Reports for Eclipse Designer Guide

WeightedAverage

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)
  • Returns
    Fractional Number
    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.



    SAP BusinessObjects
    http://www.sap.com/sapbusinessobjects/
    Support services
    http://service.sap.com/bosap-support/
    Product Documentation on the Web
    http://help.sap.com/