# Group unique rows from Column A and add other sum rows of Column B

Hi All,
I have a excel that contains Column Tracking Number ,SKU (string )and TotalOrder(int)

1.I need to find unique rows in Tracking Number
2. Append SKU

Thanks ,I will try this

(From d In dtData.AsEnumerable
Group d By k=d(â€śTrackingNumberâ€ť).toString.Trim Into grp=Group
Let cs = grp.Sum(Function (rc) CInt( â€ś0â€ť & rc(â€śTotalOrderâ€ť).toString))
Let cn = String.Join(â€ś;â€ť, grp.Select(Function (rn) rn(â€śSKUâ€ť).toString).toArray)
Let ra = New Object(){k, cs, cn}

Perfect, this is a good first start

``````Let cs = grp.Sum(Function (rc) CInt( â€ś0â€ť & rc(â€śTotalOrderâ€ť).toString))
``````

kindly note: the â€ś0â€ť& Trick will fail on negative numbers.

So we suggest the following:

``````Let cs = grp.Sum(Function (rc) CInt( rc("TotalOrder").toString.Trim))
``````

And if blanks / non valid numbers are to expect handle it before / within once the Business Requirements are redefined and specifying it in detail

What to give when we need a column after grouping without any changes ?

In general

Group d By k1=d(â€śTrackingNumberâ€ť).toString.Trim, k2=d(â€śShippdedDateâ€ť).ToString.Trim Into grp=Group

for Dates we do also check if maybe a parsing into datetime before using it within the group definition could be a better approach. Datails on this depends also on the data source

1 Like

shipped Date is in â€śDateâ€ť format in source . Kindly help me with this .

Convert.ToDateTime(d(â€śShippedDateâ€ť).ToString(â€śdd/mm/yyâ€ť) is not working

As mentioned:

[FirstAid] Datatable: Debug & Analysis invalid DateTime Strings / String to DateTime Parsing Issues - News / Tutorials - UiPath Community Forum

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