public static CoreDataSet CalculateAverage(IList<CoreDataSet> validData, Unit unit) { var average = CoreDataSet.GetNullObject(); average.Count = validData.Sum(x => x.Count.Value); average.Denominator = validData.Sum(x => x.Denominator); average.Value = (average.Count.Value / average.Denominator) * unit.Value; average.ValueNoteId = ValueNoteIds.ValueAggregatedFromAllKnownGeographyValues; return average; }
public WeightedAverageCalculator(CoreDataSetFilter coreDataSetFilter, Unit unit) { this.coreDataSetFilter = coreDataSetFilter; this.unit = unit; }