Sum of column groupped by identifier

studio

#1

Hello,

I had to do the sum of columns related to their identifier:

FR550 COMMON ENT2622837 31/03/2018 25200000
FR550 25200210
FR550 ENT2622837 25200230
FR550 ENT2622837 45200100
FR550 ENT2622837 45200000
FR550 ENT2622837 61540900
FR7K0 ENT2612259 45200000
FR7K0 ENT2612259 45200100
FRY90 COMMON 0012611448 25200130
FRY90 COMMON 0012611448 61540900
FRY90 COMMON 0012611448 45200100

keep only in a datatable: FR550 sum of th 4th column
FRY90 sum of th 4th column


#2

hi @abdel

Check this

dt.Compute(“Sum(“FR550”)”, “”).ToString();

Thanks
Ashwin S


#3

You can do it using group by in LINQ. Let me know if you need an example.


#4

Compute Sum method requires ColumnName as parameter. You have given the value as parameter.

It should be something like this:
Convert.ToInt32(dt.Compute(“SUM(Column2)”, “Column1 =‘FR550’”))

Main.xaml (7.5 KB)


#5

Hi @abdel,

You can use the groupbyAggregation Activity in the below package.

Regards
Balamurugan


#6

Hi @abdel

Here I have attached the sample for your situation which is from " BalaReva.DataTable.Activities".

File : SumAbdul.zip
(13.7 KB)

This is the output.
image

You have to install the package like below.