1 Reply Latest reply on Jul 19, 2013 7:47 AM by Alex Kerin

    I need to count occurences in my data set.

    Ratna Sarkar

      In my data set, each row represents a student. For each student, I have the majors earned by that student. I need to generate a frequency count for each major over the whole data set.

       

      In my toy data set (attached) each student can earn between one and three majors, and the set of possible majors is {HUMA, ENGI, NSCI, SOCS}. I need to be able to count the total number of occurrences of each type of major. See the little table below the toy data set -- that's the result I need.

       

      In Tableau, I have kludged this by generating, for  each student, for each major, four binary variables "is huma major", "is engi major" etc (that's 12 new variables per row), and then brute force adding stuff up. Not elegant. But the real problem is that my set of possible majors actually has about 50 elements (not just the 4 in my toy data set), so, in real life, my inelegant solution is a big mess.

       

      Any help would be highly appreciated. Thanks