KNOWLEDGE BASE

View Becomes Blank When Filtered to a String Value that Starts or Ends with a Space


Published: 03 Mar 2017
Last Modified Date: 04 Mar 2017

Issue

When a calculated field returns a string which begins or ends with a space, and the view is filtered to only that string, the view is unexpectedly blank or returns NULL. 
 

Environment

  • Tableau Desktop 10.0 and newer versions
  • Aster Data nCluster

Resolution

Option 1: Remove the beginning or ending space from the string value in the calculated field.


For example,

IF [Region] = "Central"
THEN " Group 1"
ELSE "Group 2"
END


Would become:

IF [Region] = "Central"
THEN "Group 1"
ELSE "Group 2"
END

Option 2: Use a TDC file to customize the connection

1. Download the attached aster-leave-whitespace.tdc file
2. If necessary edit the version number to match the version of Tableau Desktop being used
3. Save aster-leave-whitespace.tdc in the My Tableau Repository > Datasources folder

Important: Tableau does not test or support TDC files. These files should be used as a tool to explore or occasionally address issues with your data connection. Creating and maintaining TDC files requires careful manual editing, and there is no support for sharing these files.
 

Cause

Beginning with Tableau Desktop 10.0, Tableau Desktop conforms to SQL92 specifications, which requires trimming beginning and ending spaces from some string types from the database. As not all string types have this trimming behavior, sometimes the string value from the calculated field will have a beginning or ending space and the filter value will not, causing a value mismatch.
Did this article resolve the issue?