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:


      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:


      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):



      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!