I have this datatable where it consists a list of employees together with their Employee IDs, Positions, Hours Rendered, and assigned Project Number. I want to find the summation of hours per employee just like the image below. Can I use Filter DataTable activity? Or are there any other activities that can be used? Thank you.
As suggested by @ppr, this can be achieved through LINQ. Please refer the below screenshot and workflow files
(
From row In dt_Data
Group row By k = row("Employee ID")
Into grp = Group
Select dt_Data.LoadDataRow(grp(0).ItemArray.Reverse.Skip(1).Reverse.Append(grp.Sum(Function (gr) CInt(gr("Time Rendered")))).ToArray, True)
).CopyToDataTable
Thank you so much for sharing the exact solution. May I ask if what are the further steps that I have to do if I will only retain the “Employee ID”, “Employee Name”, and “Time Rendered” column? Thank you.
(
From row In dt_Data
Group row By k = row("Employee ID")
Into grp = Group
Select dt_Out.Rows.Add({k, grp(0)("Employee Name"), grp.Sum(Function (gr) CInt(gr("Time Rendered")))})
).CopyToDataTable