How to Convert Data Type in Tableau (Complete Guide)

When working with data in Tableau, one of the most common problems users face is incorrect data types.

In Tableau, every field has a specific data type, such as string, number, date, or Boolean. These data types define how Tableau interprets and processes the data. If the data type is wrong, Tableau cannot perform calculations correctly.

When I was working with Tableau reports, I encountered an issue: the fields in my dataset were not in the correct format.

For example, a number field was displayed as text, or a date field was displayed as a string. As a result, the calculations in the Tableau charts were not working properly. To fix this, I had to convert the field’s data type to the correct format.

While converting the field data type, I learned about various methods for converting data types in Tableau.

In this tutorial, I will explain how to convert Data types in Tableau using different methods. In addition, I will explain how to change the data type without getting Null values.

What is a Data Type in Tableau?

A data type defines the type of data stored in a field.

Common Data Types in Tableau:

  • String (Text) – Names, IDs, descriptions
  • Number (Integer/Decimal) – Sales, Quantity
  • Date – Order Date, Delivery Date
  • Boolean – True / False

Each field in Tableau has a data type, which is shown by an icon in the data pane.

Why Do We Need to Convert Data Types?

Sometimes Tableau automatically assigns the wrong data type. This can create issues like:

Problems:

  • Calculations not working
  • Filters not behaving correctly
  • Dates not recognized
  • Joins failing

Example:

If a date is stored as text:

  • You cannot use date functions
  • You cannot create time-based charts

So, converting the data type is necessary to fix these issues.

Methods to Convert Data Type in Tableau

In Tableau, there are three methods for converting field data types.

  • Convert the data type in Tableau from the data source
  • Convert the data type in Tableau from a worksheet
  • Convert data type in Tableau using a calculated field

In the examples below, I will explain all three methods for converting a Tableau field’s data type.

Method 1: Convert Data Type in Tableau From Data Source

In this example, we will convert the Order Date field from a date format to a string. This is useful when we want to display the date as plain text, such as “2025-01-01”, rather than for date calculations.

Now, connect Tableau to the data source, and then open the Data Source tab.

In the data source, we will see the field column. Now, to change the format of Order Date, click on the Date icon in the field header and select String.

Change data type in Tableau

After converting the data type to a string, we will see the field column header icon change from ‘date’ to ‘Abc’. This means the data type for the Order date field has been changed to string.

Convert a date field to string in tableau

This way, we can convert the data type in Tableau from the table header column in the Data source.

Method 2: Convert Data Type in Tableau From a Worksheet

If you don’t want to change the data source while converting the data type, we can also convert the data type in the worksheet.

In this example, I will use the custom dataset, which contains an ID field with only numbers, like ‘35340001’. By default, Tableau will take these field values as numbers. Ideally, the ID should be in string format so that we can define it as ‘US-22-57245‘.

To change the data type from a Tableau worksheet, go to the Data pane, then click on the field data type icon. For the number, enter ‘#‘, then select the String data type.

Convert data type in Tableau Fields

Now, the data type for the ID field will be changed from number to string, and the data type icon will change from “Abc” to “#”.

This method cannot be used when we need to convert IDs, such as “US-22-57245″, from strings to numbers, because the letters in the ID will not be recognized as numbers. With this, we will Null field values as shown in the table image below.

How to change data type in Tableau

This way, we can change the data type for fields in Tableau from the worksheet.

Method 3: Convert Data Type in Tableau Using a Calculated Field

In Tableau, we often need to concatenate unrelated data fields, such as the concatenating Date field with a string field. Here, we cannot concatenate the two data type fields by simply using the (+) operator.

We first need to convert the date to a string, and then we can concatenate it with another string field.

For example, to concatenate the Order date with the Region, we can use the following formula in the calculated field.

STR([Order Date]) + [Region]

Now, to show the concatenated field values, I have added the calculated field to the Columns, and we can see the combined values of the date field Order date and the string Region.

Convert field data type in Tableau

In the same way, we can use the following function in Tableau calculated fields to convert field data types.

  • STR([Field Name]): Converts to a string.
  • INT([Field Name]): Converts to an integer (removes decimal part).
  • FLOAT([Field Name]): Converts to a floating-point number (allows decimals).
  • DATE([Field Name]): Converts to a date.
  • DATETIME([Field Name]): Converts to a date and time.

This is how we can convert field data types in Tableau using calculated fields.

Method 4: Convert String to Number in Tableau Without Null Values

In Tableau, data conversion is not always straightforward when changing the field data type in the data source, the worksheet, or with calculated fields.

Recently, I was working on data of a European client, where the decimal format was in “14,656” instead of “14.656”. In Europe, decimal values are separated by a comma (,), unlike the dot (.) format used in the United States.

When I used this data in Tableau, it was set to string instead of a number. When I tried to convert comma-separated values from strings to numbers, I got null values, as shown in the image below.

Null values in Tableau data conversion

It is because then Tableau was not able to recognize the comma (,) separated values as numbers.

To solve this, we need to first go to the Datasource tab, open the data source file dropdown, and select Text file properties.

Convert data type in tableau without Null Values

In the file properties, change the locale to the one for the European country.

Convert String to number without Null values in Tableau

With this, the decimal values that are separated by a comma [,] can be changed to a number (whole or decimal) from a string.

Change data type for locale in Tableau

This way, we can convert data types in Tableau field values without getting null values.

Data Type Conversion vs Formatting

FeatureData Type ConversionFormatting
PurposeChange actual data typeChange appearance
ImpactAffects calculationsChange the actual data type
ExampleString – DateDate format DD/MM/YYYY

Frequently Asked Questions

1. What is a data type in Tableau?

A data type defines the type of data stored in a field, such as text, number, or date.

2. Why is data type conversion important?

Because incorrect data types can break calculations and visualizations.

3. How to convert a string to a date in Tableau?

DATE([Field Name])

4. Why am I getting NULL values?

Because Tableau cannot recognize the data format.

5. Can we change the data type permanently?

Yes, using the Data Source tab.

Conclusion

In this tutorial, we learned several methods for converting data types in Tableau. In the above examples, we have learned how to change the data type in the data source and the worksheet, as well as use a calculated field for data conversions and concatenation.

By applying these methods, we can ensure that Tableau field data types are in the correct format, which helps build accurate charts and avoid null values.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.