This code multiplies the volume for month 1 by a growth factor:
forecastData.Where(c => c.Date == months.ElementAt(1)).Sum(c =>
(c.Volume * c.Growth))
I want to be able to use the growth value from month 6 in this expression also. Something where I can use x as the value from month 6 so the outcome would be:
.Sum(c => (c.Volume * c.Growth) * x.Growth)
Is this possible?
The data class:
public class ForecastedVolumeMonthly
{
public int VolumeMonthlyId { get; set; }
// Location
public int DepartureDepoId { get; set; }
public virtual Depo DepartureDepo { get; set; }
// Destination
public int DestinationDepoId { get; set; }
public virtual Depo DestinationDepo { get; set; }
// Nationality
public int NationalityId { get; set; }
public virtual Country Nationality { get; set; }
public long? Volume { get; set; }
public double? Growth { get; set; }
public DateTime Date { get; set; }
}