How can i find the Maximum Occurrence of a value in a column of a datatable

Hey, i need help in finding the Maximum Occurrence of a value in a column of a datatable

Hi @Anifowose_Temi,

Try the solution in this post:

Hi @Anifowose_Temi ,

After reading the Excel Sheet as a Datatable, say DT. You could use the Below Expression to get the Max Occurrence of the Value :

DT.AsEnumerable.Where(Function(x)x("YourColumnName").ToString.Equals(in_Value)).Count

or

You Could also Read the Column as an Array of String/Object and Pass it to the Below Component :

1 Like

Hi,

If you want to get the most occurrence values in a column, the following will help you.

Value

dt.AsEnumerable.GroupBy(Function(r) r("ColumnName").ToString).OrderBy(Function(g) g.Count).Last().First().Item("ColumnName").ToString()

Count

dt.AsEnumerable.GroupBy(Function(r) r("ColumnName").ToString).OrderBy(Function(g) g.Count).Last().Count

Regards,

1 Like

Thanks. This worked

1 Like

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