How to get data in column based on another column field

@saraawq

Declaration
DataTable Variable as dta
Dictionary(Of string, Of string) as Dictionary

Query

Dictionarty=( From p in dta.Select
group p by Department=p.Item("DEPARTMENT") Into GroupA=Group
Select GroupA).ToDictionary(Function(x) x(0)("DEPARTMENT").ToString, Function(x) Convert.ToString(x.Sum(Function(y) Convert.ToDouble(y.Item("Work HR").ToString))))

Now the Key value of the Dictionary will be Department and the Value will be sum of working hours of that particular Department.

So You can get the working Hours of Deepartment1 by Dictionary(Department1).ToString and
Deepartment2 by Dictionary(Department2).ToString
Sou can use the same query with slight modifications of column names for grouping and getting sum of other columns.

Regards,
Mahesh