Data Types in Tableau

by Beau Foletti

Every piece of data is categorised into one of four data types. This is assigned to each bit of the data so Tableau, as well as other products (Alteryx, Excel, etc), know how to handle and use this data when asked. The four data types are as follows: String, Numeric, Boolean and DateTime (or just Date). Each data type has its own rules and coding so a computer understands how to recall and aggregate different information in relation to each other. Each data type comes with its own techniques to make data manipulation more simple, for the computer as well as us humans.

1) String

One of the most common data types. This data type can be a sequence of letters and/or symbols and numbers. Examples could include, names, instructions and IDs. A combination of numbers could be a string, the computer however will understand this as a sequence of characters, meaning they will not be able to be aggregated. Strings are stored within a single ('') or double ("") quotes. Many things can be done with strings, such as sorting alphabetically, splitting at certain points in the string and and searching within a string.

2) Numeric

Numbers, as seen above, can be stored as strings, however the computer will not recognise them as numbers, therefore it will not be able to make calculations. To use them as numbers, the string data type must be changed to numeric. There are two types of numeric data, integers and floats. Integers are registered in the computer as whole numbers, whereas floats can be decimals (though not necessarily). There are also types of numeric data type for the amount of digits used. A Byte can do 8 decimal places, int16 16 places, int32 32 and int64 64 digits/decimal places.

3) Boolean

A Boolean is either 'True' or 'False'. This data type is used when something satisfies a condition, or doesnt. They can be useful when splitting data due to conditions. Boolean operators decide if the result is True or False. These include AND, OR and NOT. The true or false result is/can be stored as ones and zeros.

4) DateTime

A date can be written as a string in many ways, however, like numeric values, it must be converted into a specific data type so Tableau (and other programs) know that it is a date and can preform date related tasks, such as sorting chronologically. In Tableau, the date format is yyyy-MM-dd, whilst time is hh:mm:ss. DateTime, as the name suggests, stores date and time, where Date just stores the date.

Changing Data Types in Tableau

Changing a data type is simple in Tableau, as long as it satisfies the data conversion rules. Every field in the data pane (left side) has an icon at the left hand side of the name. Select this and choose which data type is the best to use. It is recommended to change the data types when initially understanding and exploring the data. This should really be saved to the data source, so other users do not have to change the data types again.