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.
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!
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.