System.Data.DataTable oldDataTable = new DataTable(); oldDataTable.Columns.Add("CheckinNum"); oldDataTable.Columns.Add("CustomerAmount"); oldDataTable.Columns.Add("ProviderAmount"); oldDataTable.Columns.Add("AgentAmount"); oldDataTable.Columns.Add("GrossAmount"); oldDataTable.Columns.Add("TheMonth"); int N=17; System.Data.DataRow dr = oldDataTable.NewRow(); for (int i = 1; i < N; i++) { dr = oldDataTable.NewRow(); dr["CheckinNum"] = 1; dr["CustomerAmount"] = 2; dr["ProviderAmount"] = 3; dr["AgentAmount"] = 4; dr["GrossAmount"] = 5; dr["TheMonth"] = i<=12?i:1; oldDataTable.Rows.Add(dr); } for (var i = 1; i <= 12; i++) { oldDataTable.Rows.Add(0, 0, 0, 0, 0, i); } var haha = oldDataTable.Rows.Cast<DataRow>().GroupBy(x => x["TheMonth"]) .Select(x => new { TheMonth = x.Key, CheckinNum = x.Sum(x1 => Convert.ToInt32(x1["CheckinNum"])), CustomerAmount = x.Sum(x1 => Convert.ToInt32(x1["CustomerAmount"])), ProviderAmount = x.Sum(x1 => Convert.ToInt32(x1["ProviderAmount"])), AgentAmount = x.Sum(x1 => Convert.ToInt32(x1["AgentAmount"])), GrossAmount = x.Sum(x1 => Convert.ToInt32(x1["GrossAmount"])) }).ToList(); //TODO : Convert haha to DataTable Type.