title: Create custom column in Linq with sum total of column
body: <p>How to Create custom column using linq? coz i alway get error</p>
  
  <p><strong>Fig. 1</strong></p>
  
  <blockquote>
    <p>Sequence contains more than one element</p>
  </blockquote>
  
  <p>Data from grid that i selected as context
  <img src="https://i.stack.imgur.com/EJTsn.png" alt="enter image description here"></p>
  
  <p>My code seems right when removing custom column that iv'e created TotalAmount</p>
  
  <pre><code>var studentservices = from ser in result.ToList()
                                            where partStudentServices.Contains(ser.Description)
                                            group ser by ser.Description into gser
                                            select new
                                            {
                                                CCode = gser.FirstOrDefault().Code,
                                                CDescription = gser.FirstOrDefault().Description,
                                                CAmount = gser.Where(s =&gt; s.EducationLevel == "College").Select(ns =&gt; ns.Amount).Sum(),
                                                HAmount = gser.Where(s =&gt; s.EducationLevel == "High School").Select(ns =&gt; ns.Amount).Sum(),
                                                GAmount = gser.Where(s =&gt; s.EducationLevel == "Grade School").Select(ns =&gt; ns.Amount).Sum(),
                                                KAmount = gser.Where(s =&gt; s.EducationLevel == "Kinder").Select(ns =&gt; ns.Amount).Sum(),
                                                TotalAmount = gser.GroupBy(g =&gt; g.Description).Select(ns =&gt; ns.Sum(sumn =&gt; sumn.Amount))
                                            };
  
  
                      d.StudentServicesReport.DataSource = studentservices.ToList();
                      d.xTC_StudentServices_Code.DataBindings.Add("Text", null, "CCode");
                      d.xTC_StudentServices_Name.DataBindings.Add("Text", null, "CDescription");
                      d.xTC_StudentServices_College.DataBindings.Add("Text", null, "CAmount");
                      d.xTC_StudentServices_HS.DataBindings.Add("Text", null, "HAmount");
                      d.xTC_StudentServices_GS.DataBindings.Add("Text", null, "GAmount");
                      d.xTC_StudentServices_PS.DataBindings.Add("Text", null, "KAmount");
                      d.xTC_StudentServices_CollegeTotal.Text = studentservices.Select(sa =&gt; sa.CAmount).Sum().ToString();
                      d.xTC_StudentServices_HSTotal.Text = studentservices.Select(sa =&gt; sa.HAmount).Sum().ToString();
                      d.xTC_StudentServices_GSTotal.Text = studentservices.Select(sa =&gt; sa.GAmount).Sum().ToString();
                      d.xTC_StudentServices_PSTotal.Text = studentservices.Select(sa =&gt; sa.KAmount).Sum().ToString();
                      d.xTC_StudentServices_Total.Text = studentservices.Select(sa =&gt; sa.TotalAmount).ToString();
  </code></pre>
  
  <p>but get error see Fig. 1</p>
  
  <p>coz im going to generate a report this should be the output. the red text should be the total amount of each row.
  <img src="https://i.stack.imgur.com/fC1dg.png" alt="enter image description here"></p>
  
  <p>on printing the error shown on cell that i assign.
  <img src="https://i.stack.imgur.com/7BjCO.png" alt="enter image description here"></p>
  
  <p>Anyone can help me? I'm stuck on this module about 1 hour.</p>