All fields in a data source have a data type. The data type reflects the kind of information stored in that field, for example integers (410), dates (1/23/2015) and strings (“ShishirKant”). The data type of a field is identified in the Data pane by one of the icons shown below.
Data type icons in Tableau
|Text (string) values|
|Date & Time values|
|Boolean values (relational only)|
|Geographic values (used with maps)|
|Cluster Group (used with Find Clusters in Data)|
You can change the data type for a field either on the Data Source page or in the Data pane.
Change the data type for a field in the Data Source page
Sometimes Tableau incorrectly interprets the data type of a field. For example, Tableau might interpret a field that contains dates as an integer data type, rather than a date data type.
You can change the data type for a field that was part of the original data source (as opposed to a calculated field created in Tableau) on the Data Source page.
- Click the data type icon for the field (as shown in the table above).
- Choose a new data type from the drop-down list:
Tip: Be sure to change data types before you create an extract. Otherwise, your data may not be accurate. For example, if a floating-point field in the original data source is interpreted as an integer by Tableau, and you create your extract before you change the field’s data type, the resulting floating-point field in Tableau will have some of its precision truncated.
For information on changing data types on the Data Source page,
Change the data type for a field in the Data pane
To change the data type of a field in the Data pane, click the icon to the left of the field name, and then choose a new data type from the drop-down list.
Change the data type for a field in the view
To change a field’s data type in a view, right-click (control-click on a Mac) the field in the Data pane, choose Change Data Type, and then select the appropriate data type from the drop-down list.
Note: Sometimes the data in your database is more precise then Tableau can model. When you add these values to the view, a precision warning appears in the right corner of the status bar.
Mixed data types in data from files
Most columns in a Microsoft Excel, Microsoft Access, or CSV (comma-separated value) file contain values that are all of the same data type (Booleans, dates, numbers, or text). When you connect to the file, Tableau creates a field in the appropriate area of the Data pane for each column. Dates and text values are dimensions, and numbers are measures.
However, files that you connect to might include columns that have a mixture of data types, such as numbers and text, or numbers and dates. When you connect to the file, the mixed-value column is mapped to a field with a single data type in Tableau. Therefore, a column that contains numbers and dates might be mapped as a number data type (making it a measure) or it might be mapped as a date data type (in which case Tableau treats it as a dimension.)
Tableau determines how to map mixed-value columns to data types by the data types of the first 10,000 rows in an Excel data source, and the first 1,024 rows in a CSV data source. For example, if most of the first 10,000 rows are text values, the entire column is mapped to use the text data type.
Note: Empty cells also create mixed-value columns because their formatting is different from text, dates, or numbers.
When Tableau determines a data type for each field, if the values in a field don’t match that data type, Tableau handles the field in one of several different ways, depending on the data type. For example, sometimes Tableau populates those fields with Null values, as shown in the following table:
|Mapped data type||Treatment of other data types in the field.|
|Text||Dates and numbers are treated as text. Nulls are not created.|
|Dates||Text is treated as Null. A number is treated as the day in numeric order from 1/1/1900.|
|Numbers||Text is treated as Null. A date is treated as the number of days since 1/1/1900.|
|Boolean||Text, dates, and numbers are treated as Null.|
If using fields that are based on mixed-value columns introduces difficulties when analyzing your data, you can do one of the following:
- Format empty cells in your underlying data source so that they match the data type of the column.
- Create a new column that does not contain the mixed values.