How to count sum by matching columns using UIPATH

Hello, I am new to UiPath and i need your help to understand how to solve this task. I have three columns called “Id Code”, “Id Person” and “Expenses”. I need to group (Id Code) with (Id Person) and calculate those columns expenses. I also insert example of columns. P.S highlighted columns are example how to count. Thank you for your time, I really appreciate it! Example2

@Milda_x Follow these Steps :

  1. Read the Excel File using Workbook Read Range and get the Output Datatable, say DT

  2. Then use the Below Expression in an Assign Statement :
    Output_DT = (From p In DT.AsEnumerable() Group By x= New With { Key.a =p.Item(“Id Code”),Key.b =p.Item(“Id Person”)} Into Grp = Group Select DT.Clone.LoadDataRow (New Object() {grp(0)(0),grp(0)(1),grp.Sum(Function ( r ) if(String.IsNullOrEmpty(r(“Expenses”).ToString) or String.IsNullOrWhiteSpace(r(“Expenses”).ToString),0,Convert.ToDouble(r(“Expenses”).ToString)))},False)).CopyToDataTable

Where Output_DT is a Datatable Type variable.

Check if this Works

1 Like

Thank you, you helped me a lot!!

1 Like

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