3 Replies Latest reply on Sep 30, 2014 6:46 AM by Darin Coulter

    countd not counting text

    Karen Massey

      I have a code set called Codes, which has values like

      I created a calculated field called Code Count to count distinct occurrences of codes in the data source:

      However, the resulting counts do not include the values that are text, i.e., the <<Missing Code>> and RS-3 values.

      Why, and how can I get a true count of distinct codes in my source data?

        • 1. Re: countd not counting text
          Darin Coulter

          Is the Data Type in Tableau for the Code field currently String or Number ?  (right click on Codes in your dimension pane - go down to Change Data Type).


          If the data type has been explicitly set as Number - the strings will be NULL (unknown) and won't be counted. 


          However - if it's string - I don't have an answer.

          • 2. Re: countd not counting text
            Karen Massey

            thanks for the response.  It turns out that the string data type was the problem, but it was tricky to find the root cause.


            I changed the data type of Code in the dimension pane to string, and refreshed the data, but this did not fix the problem. 

            I created an extract of the data (rather than live source), but this did not fix the problem.

            When I Edit(ed) the Data Source, I saw that the Code field was a string type:


            But it wasn't until I clicked on the Abc link in the Code column that Tableau recognized the text fields and pulled them into the viz.


            I'm a newbie user, so tell me if this is a bug or it's just me!

            • 3. Re: countd not counting text
              Darin Coulter

              I'm glad you were able to resolve the issue.  I wouldn't be able to say whether this example is a bug or not.  It doesn't seem like it should be that cumbersome to have a string data type represented accurately.  However, when I tried to re-create this scenario with some dummy data - it was as simple as toggling between number and string and I got the expected functionality. 


              A support request with Tableau would serve you better to understand whether this is a bug or not.  Or more experienced users might see this thread and make a comment also - I just can't say for sure either way.