Reputation:
i have a Datatable
in which there are Columns are
Assigned to
Storyid,
Completed,
Effort.
assigned to person can have Same Storyid with diffrent or same (Completed,Effort hours)(image attached)
i want dataTable to like in this form where Assigned to Effort and completed hours will be Sum and there storyid's(image attached below
output datatable
Upvotes: 0
Views: 47
Reputation: 7110
I hope this is what you are looking for
var result = yourDatatable
.GroupBy(e => e.AssignedTo)
.ToList()
.Select(eg => new
{
AssignedTo = eg.Key,
CompletedSum = eg.Sum(p=>p.completed),
EfforSum = eg.Sum(p=>p.effort),
StoryIds = string.Join(",", eg.Select(i => i.storyid))
});
Upvotes: 2