I have a use case where I want to calculate the count of different category values for each batch and if the count exceeds a certain limit the want to add one of the categories to the new column.

As here for each batch record id: 1-6 if count (A) >=3 then A else C.
thanks