How to get the count of the duplicate columns from a DT

Hi,
MicrosoftTeams-image

left side is the Input for the DT , and i need the Output as the Right Table.
can you please help me to find out the logic using LinQ only.

Thank you in Advance!!

@kmaddikatla
Welcome to the forum

Prepare an empty DataTable with build datatable and configure the target column structure - dtTarget

OR
dtTarget = dtOrig.Clone + Add Data Column activity and add the Count col at the end

Assign Actvity
dtTarget =

(From d in dtOrig.AsEnumerable
Group d by k1=d("Name").toString.Trim, k2=d("Sports").toString.Trim into grp=Group
Let ra = new Object(){k1,k2, grp.Count}
Select r = dtTarget.Rows.Add(ra)).CopyToDataTable

it is working .
thank you @ppr ,

Happy Automation :smiley:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.