How do i filtered the majority account avaible in Datatable column "Account"?

Hello

I have a data table and I need to select the most frequently occurring value in the “Account” column. For example, if the column contains “Interest” 8 times and “Travel” 5 times, I need to select “Interest.” The specific strings “Interest” and “Travel” can change, but the goal is to pick the value that appears most frequently in the column.

How can I do it?

image

Hi @Kishan_Savaliya

refer the below thread.

Hope it helps!!!

1 Like

Hi @Kishan_Savaliya

Can you try like below

DT.AsEnumerable().
       GroupBy(Function(row) row.Field(Of String)("Account")).
       OrderByDescending(Function(Group) Group.Count()).
       Select(Function(Group) Group.Key).
       FirstOrDefault()

Regards,

1 Like

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