Sum up same name's price + remove same name's row

Hello
I want to make this datatable

fruit price
apple 30
apple 50
apple 20
pear 20
pear 10
banana 20
banana 25

to

fruit price
apple 100
pear 30
banana 45

Please help me :slight_smile:

@hoseongwon
Use the groupby function to get your desired output:

(From d In dt.AsEnumerable Group d By k=d(“fruit”).toString.Trim Into grp=Group Let value = grp.Sum(Function (x) CDbl(x(“price”).toString)) Let ra = New Object(){k, value} Select dtNew.Rows.Add(ra)).CopyToDataTable

regards,

1 Like

Wow. Thank you. but I am so new at UiPath. so hard to understand from begining. …(From “d” …what is d?

@hoseongwon , you can refer the below thread for a brief explanation:

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