Hi everyone,
I haven`t been able to solve this problem for a few days now. I have a data set that needs to be grouped and have the count of how many times this variable appeared in this group as shown bellow. However, everytime I try to group these variables and when I try to find the count of these variable I can only find a right count for Var1.
Sample input data set:

Required result:

Thank you.