Tableau is a business intelligence and data analysis tool, data is the main thing we are always dealing with it. Data is an important functional element in Tableau. It is also important for us to learn and understand the different data types used in Tableau.
A data type is a classification that specifies which type of value a variable has and what type of mathematical, relational, or logical operations can be applied to it without causing an error.
The data type categories the data value into its definite types:
In a similar way, every data value will fall under a certain category of the data type. Tableau also has a set of data types based on which, it characterizes every data value present in it as field values either from a live data connection or as a data extract from the data source.
You can use around seven data types in Tableau. Tableau automatically detects the data types of various fields as soon as new data gets uploaded from the source to Tableau and assigns it to the fields. You can also modify these data types after uploading your data into Tableau.
A string is a data type that contains zero or more characteristics in the text format, and the value will be considered as a string when it is encoded in single or double-quotes are called string data types.
Ex: "Apple", 'Orange'.
The String Data type is further divided into two categories:
The value of the Char string data type has a fixed length and the memory corresponding to this fixed length is allocated to the char string type values in Tableau.
If you try to enter a string value greater than the fixed length then the system will throw an error. Char string data types usually store alphanumeric data values.
Ex: String= "NUM11"
Varchar string type stands for variable character length where the length of the characters to be entered in a string is not fixed or predefined.
Here, you can enter as many characters as you want without having any memory allocation restrictions, this type of string also can have alphanumeric data values.
Ex: String= "CherCher"
If a data value present in the data type contains only numbers in them, then this kind of data type is called numeric data types, the data values can be either an integer type or floating type.
Most fields having numeric data types are integer types. Even if floats are used, then they are often rounded up to integer by using the Round function.
Ex: A=222, N=455.00=455
The data value present in the data type contains data in the date and time format then the data type is called a date-time data type.
In Tableau, you can use almost all the formats of date and time such as dd-mm-yy, dd-mm-yyyy, or mm-dd-yyyy, etc. Some fields can only contain a date value or a date can exist along with the time.
The time data values can be a decade, year, quarter, month, day, hour, minutes, seconds, etc., if you wish to add a date value in the form of string characters, add a # sign before it.
Ex: #20 January 2020
The boolean data type values are a result of relational calculations. Therefore, True and False boolean values are known as logical values. Sometimes, the result of a relational calculation is unknown and obscure. Such values are shown as Null values.
Ex: If A=4 and B=8, A>B=False.
The geographic data types are the data values that are used in a map. Values such as country name, state name, city, region, postal codes, etc. belong to the geographic data type. The fields of this data type are denoted by a globe icon.
Tableau, sometimes might not contain a single data type, instead, it contains a mixture of data types, which is called a cluster or mixed data types. In such scenarios, either you can manually handle such fields by segregating values belonging to different data types into the column or you can let Tableau handle it.
Tableau detects and assigns respective data types to all the existing fields in a data set during fresh data upload. However, you can make changes in the data types at many stages while working with Tableau. Three of which are shown below:
Another way to change the default data type of a field is from the view.