public ActionResult CommulativeCAmount()
{
MPOWERINGDBContext db = new MPOWERINGDBContext();
DateTime twelveMonthsBeforeNow = DateTime.Now.AddMonths(-12);
var comid = Convert.ToInt32(Session["MyId"]);
var query = db.Cases.Where(x => x.CompanyID == comid).Where(x => x.ReceievedDate >= twelveMonthsBeforeNow)
.GroupBy(p => new { p.ReceievedDate.Value.Month,p.ReceievedDate.Value.Year })
.OrderBy(x=>x.Key.Year)
.Select(g => new {
mymonth = (string)g.Key.Month.ToString(),
myAmount = (double)g.Sum(w => w.TotalCollection),
}).ToList();
return Json(query, JsonRequestBehavior.AllowGet);
}
i want to store commulative sumamount in myAmount using linq query above is my linq query data show correct but i want to show commulative amount?