7 Replies Latest reply on Jun 30, 2017 4:56 PM by Deepak Rai

    Frequency table by condition or only count last record in IDs

    Angela Lin

      Hi all,

       

      I have this data below:

      2017-06-30_13-41-45.png

      I'm doing a frequency table for type with unique IDs, but for the IDs that have both A and R, I just want it to count as R. For example, ID1 will count as A, ID2 will count as R. The target would be:

      Type A: 3

      Type R: 3

       

      Now I'm having this:

      2017-06-30_14-06-23.png

      Tableau is counting ID2 and ID6 in both A and R, but I just want them to be counted in R.

      Is there anyway I can create a filter for this?

       

      Or what code should I use if I want to create a new variable, new Type, which is to change the A in ID2 and ID6 into R, other than just hard code it as (if ID=2 then new type =R):

      2017-06-30_14-20-14.png

       

      Or is it possible to sort the data by ID and type, and then just count the last row for each ID?

       

      Any help would be a lot appreciated!

      Thanks!

       

      Angela