Sum values group by columns


Hi guys,
I have just started work with UIPath and have some issues.
can you please help me to understand how to develop the follow code in UI Path for DataTable:
select client_number, Currency, Start_Date, End_Date, sum(Amount) as sum_amount, sum(Commision) as commision
group by client_number, Currency, Start_Date, End_Date
The excel example is attached.
Thank you very much in advance!
DimaUntitled.xlsx (10.8 KB)


Hi @Stelz,

Refer this


1 Like
Sum of all Repeated values in Excel

HI @Stelz,
It may help you.


1 Like
Sum of all Repeated values in Excel

Thank you very much. It works. Sorry for late reply

1 Like

How can you sum the values of a column without using balareva.datatable.activities ?


Hi @Fer
Try below code

DataTableName.Compute("Sum(Amount)", string.Empty);

Arivu :slight_smile:


Amount is the name of the column that i am searching values to sum?


Yes “Amount” is column name from the datatable which you want to sum


DataTableName is as System.Data.Datatable
sum = DataTableName.Compute(“Sum(Amount)”, string.Empty) where sum is defined as int32

Returns error


sum= Convert.ToInt32(DataTableName. Compute("SUM(Amount)", string.Empty))

Arivu :slight_smile:


Returns this error: Assign : Invalid usage of aggregate function Sum() and Type: Object.


Ok try below code

DataTableName.AsEnumerable.Sum(Function(x) If(IsNumeric(x("Amount").ToString.Trim),CDbl(x("Amount").ToString.Trim),0))

Arivu :slight_smile:

1 Like

How do you have declared the variable that is storing the code? Since I’m not getting AsEnumerable


hi fellow, it seems this activity only can group and sum of on colunms, is it works while group multiple columns?