Group by multiple columns in data table and get count of one column and select rest of the non grouped columns

@lk_18
welcome to the forum

have a look here as well:

Clone datatable: dtResult = dtDataTableVar
Add a new column to dtResult - Add DataColumn Activity - ColumnName: count

Assign Activity
Left Side: dtResult
Right side:

(From d in dtDataTableVar.AsEnumerable
group d by k1=d("Name").toString.Trim(),k2=d("Class").toString.Trim(),k3=d("Leave").toString.Trim() into grp=Group
let f = grp.First()
let ra = new Object(){f(0),k1,k2,f(3),k3,grp.Count}
Select dtResult.Rows.add(ra)).CopyToDataTable