David Smith

David Smith

  • NA
  • 2k
  • 0

Linq Conversion error: IEnumerable<ColorMetric> to double

Apr 15 2022 5:26 PM

I am getting an error below can't convert IEnumarble< > to double. Can someone assist me with the line in bold. I am simply try to sum or add up the ColorAmount Details records where color type == red

    MetricList = Reporter.GetColorData();

MetricList = (from DetailRoot o in Metrics
                             group o by (o.UserId, o.SessionId) into t
                                select new ColorMetric()
                                 {
   
     TotalRevenue = t.Select(s => s.Details.Where( t => t.ColorType == "Red").Sum( u => u.ColorAmount)) 

                                 }).ToList();


Answers (1)