Aggregating Total Invoices for Duplicated Customer Orders in different sheets

Hello everyone,
I’m facing an Excel-related issue in calculating columns in different sheets.

I would greatly appreciate any assistance and Thank you to anyone who can help!

Hi @sasadrinksprite

→ Use the read range workbook activity to read the Order Data sheet and store in a Datatable called dt1.
→ Use another read range workbook activity to read the Customer Invoice sheet and store in a datatable called dt2.
→ Take an assign activity and write the below linq expression

- Assign -> dt2 = (From row1 In dt1.AsEnumerable()
                   Join row2 In dt2.AsEnumerable() On row1.Field(Of String)("Customer Name") Equals row2.Field(Of String)("Customer Name")
                   Group row1 By CustomerName = row1.Field(Of String)("Customer Name") Into Group
                   Select dt2.Rows.Add(CustomerName, Group.Sum(Function(row) row.Field(Of Double)("Total Price")))).CopyToDataTable()

→ Use write range workbook activity to write the dt2 to the Customer Invoice Sheet.

Check the below workflow for better understanding,

Input -
Order Data Sheet -

Customer Invoice Sheet -

Output -

Hope it helps!!

1 Like

describes Non-LINQ / LINQ Approaches for your case

1 Like

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