3 Replies Latest reply on Dec 21, 2018 2:02 PM by Joe Oppelt

    COUNT and CONTAINS?

    sue slivan

      I'm using Tableau Public, so I'm not sure how to attach a workbook.

       

      I'm trying to get counts of reference questions in a library.  The problem is they can be coded as multiple question types:

      If I drag [Question type] to Tableau, it creates every possible combination of types as their own.

       

      For example, 22 questions include ILL, but only 7 exclusively are labeled ILL.

      I want Tableau to tell me that 22 records include ILL.

       

      The raw data from my spreadsheet:

      I tried a calculated field to try and count the number of times each category is mentioned

       

      But Tableau only shows me the number of times that ILL is uniquely labeled.

       

       

      What can I do to get the answer I want? I tried a few different operations but keep getting errors, and I'm not a programmer. AT ALL.

        • 1. Re: COUNT and CONTAINS?
          Joe Oppelt

          Your calc will return only the first "hit" in that long string of ELSEIFs.

           

          If a hypothetical [Question Type] is "Archives ILL", your calc will only count the "Archives" part and will stop looking further.  Typical computation logic for compound statements stops as soon as the first TRUE condition is hit.  And that's what Tableau does.

          • 2. Re: COUNT and CONTAINS?
            Chris McClellan

            Adding to Joe's comment as well, in computer logic   "Archives" is not the same as "archives", so you would have to add a LOWER() around your CONTAINS() so that you're actually doing "archives" = "archives" but you might want to leave "ILL" as "ILL" depending on your data.

            • 3. Re: COUNT and CONTAINS?
              Joe Oppelt

              Chris!! Haven't seen you around lately!  (Maybe we just haven't frequented the same threads...)

               

              Merry Christmas to you, man!  Some day I would like to experience a summertime Christmas!  (But at least I do a little Aussie Christmas when I listen to my Christmas in Australia CD.  "Six White Boomer", and other Aussie favorites.    )