Data table group by total count and row value

I would like to group the below fields
Column 1 Column 2
12345. Failed
12345. Failed
12345. Success
12344. Success

The output should be like
Count. Failed. Success
4. 2. 2

Hi @Jayaraman_Kumar

Check the below workflow file:

outputDataTable = (From row In inputDataTable.AsEnumerable() Group row By key = row("Column1") Into Group Let failedCount = Group.Count(Function(r) r("Column2").ToString() = "Failed") Let successCount = Group.Count(Function(r) r("Column2").ToString() = "Success") Select outputDataTable.Rows.Add({Group.Count(), failedCount, successCount})).CopyToDataTable()
Sequence3.xaml (12.1 KB)

Hope it helps!!

2 Likes

Hi,

How about the following?

new Object(){dt.Rows.Count,dt.AsEnumerable.Count(Function(r) r(1).toString="Failed"),dt.AsEnumerable.Count(Function(r) r(1).toString="Success")}

Sample
Sample20240322-2.zip (8.8 KB)

Regards,

1 Like

Have a look below on Non-Linq / Linq Options for grouping data and processing the group members

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