How to Change Data Type in Tableau

Cody Schneider••8 min read

Getting your data types right in Tableau is the foundation for creating accurate and effective visualizations. Tableau is smart, but it sometimes guesses a field's type incorrectly, treating your numerical postal codes like numbers to be summed or your dates like simple text. This quick guide will walk you through how to change data types in Tableau, ensuring your data is ready for analysis.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What Are Data Types and Why Do They Matter?

In Tableau, every field in your data source is assigned a data type. This tells Tableau what kind of data the field contains, which determines how you can work with it. For example, you can calculate the average of a number field, but you can't calculate the average of a text field.

Getting these right is essential. If your sales figures are accidentally categorized as text, you won't be able to create a proper sales trend chart. If your dates are text, you can't use Tableau's powerful date hierarchy features to drill down from year to quarter to month.

Here’s a quick rundown of the most common data types you’ll encounter:

  • String: Represented by an "Abc" icon. This is for text values like customer names, product categories, or notes.
  • Number (Decimal or Whole): Represented by a "#" icon. This is for numerical values you might want to perform calculations on, like sales, quantity, or GPM. Tableau separates these into decimal (numbers with fractions) and whole (integers).
  • Date & Date and Time: Represented by a calendar icon. This is used for temporal data. The "Date" type includes just the day, month, and year, while "Date and Time" also has hours, minutes, and seconds.
  • Boolean: Represented by a "T|F" icon. This is for fields that only have two states, such as true/false, yes/no, or 1/0. These are perfect for creating filters.
  • Geographical Role: Represented by a globe icon. While not a standalone "type," it's a role you can assign to a string field. This tells Tableau that the text data represents geographic information like country, state, city, or postal code, allowing you to build maps.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Why You Might Need to Change a Data Type

Data rarely arrives in a perfectly clean state. You’ll frequently need to adjust data types for a few common reasons:

  • Incorrect Auto-Detection: Upon connecting to a data source, Tableau scans the first few rows to infer the data type for each column. If your postal code column contains only numbers in the first 1,000 rows (e.g., '90210'), Tableau will think it's a number. But geographic IDs like this should be treated as text (strings) or geographic data to avoid accidental aggregation.
  • Fixing Messy Dates: Dates are often a culprit. They can be imported from a CSV or spreadsheet as text, such as "Jan 15, 2024" or "2024-01-15". To use Tableau’s date functions, you’ll have to convert that string into a 'Date' data type.
  • Prepping Boolean Fields: Sometimes your data contains indicators like '1' for "Yes" and '0' for "No". While Tableau can often handle this, explicitly changing the data type to Boolean (True/False) makes a field’s purpose much clearer and more reliable for filters and calculations.
  • Preparing for Joins: When you join tables, the fields you are joining must have the same data type. If the 'UserID' in one table is a number and in another, it’s a string, the join will fail. You'll need to change one of them to match.

How to Change Data Types in Tableau: Three Methods

Correcting a data type is straightforward. Tableau provides a few different places to do it, depending on where you are in your workflow.

Method 1: On the Data Source Page (The Best Practice)

The best time to fix your data types is right after you connect to your data source. Correcting them here ensures the data is properly structured before you start building anything. This is the cleanest and most efficient approach.

  1. Navigate to the Data Source tab in the bottom-left corner of your Tableau workspace.
  2. Once you're on the Data Source page, you'll see a preview of your data in a grid, with columns representing your fields.
  3. Above each column header, you'll see a small icon representing the current data type ("Abc" for string, "#" for number, etc.).
  4. Click on that icon. A dropdown menu will appear with a list of available data types.
  5. Select the new data type you want to apply. For example, if you have a 'Zip Code' column formatted as a Number (#), click the icon and select "String."

That's it! Tableau will immediately convert the data in that column. Doing this at the source fixes the issue once, so you don’t have to worry about it again in any of your worksheets.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Method 2: In the Data Pane of a Worksheet

Sometimes you’re already deep into building a visualization when you realize a data type is wrong. You don’t have to go all the way back to the Data Source page, you can make the change right from the worksheet.

  1. Make sure you’re in a worksheet view.
  2. Look at the Data pane on the left side of the screen. You will see a list of all your data fields, organized under Dimensions and Measures.
  3. Find the field you want to change. You'll see the data type icon just to the left of the field name.
  4. Click on the icon. A small menu will pop up.
  5. Select Change Data Type from the menu, then choose the correct type from the subsequent list (e.g., Number (whole), Date, String).

This method is quick and convenient for on-the-fly corrections. The change you make here will be reflected across your entire Tableau workbook.

Method 3: Using a Calculated Field for Complex Conversions

What happens when data is so messy that a simple type change won't work? For example, you have a non-standard date format like '15/January/2024' or you need to extract and convert a part of a string.

This is where calculated fields come in. They let you run functions to clean or reshape your data before changing its type. The most common functions for this are DATE(), DATETIME(), DATEPARSE(), and MAKEDATE().

Let’s say your date is stored as a text string like “20240115”. A direct conversion probably won’t work. Instead, you can create a calculated field to interpret it.

Using a Tableau Function: An Example with DATEPARSE()

The DATEPARSE() function is extremely powerful because it lets you specify the exact format your date string is in.

  1. In the Data pane, click the small dropdown arrow at the top right and select Create Calculated Field.
  2. Give your new field a name, like "Order Date (Corrected)".
  3. In the formula box, you'll write an expression to convert your original string field. Let’s assume your messy date string is called [Order Date String] and its format is 'yyyyMMdd'. The formula would be: DATEPARSE('yyyyMMdd', [Order Date String])
  4. This tells Tableau to expect a four-digit year, followed by a two-digit month, followed by a two-digit day, and to parse the [Order Date String] field accordingly.
  5. Click OK. Tableau will create a new field that is a proper Date type. You can now use this new, corrected field for all your visualizations and hide the original messy one.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Troubleshooting Common Data Type Problems

Making a change can sometimes lead to unexpected results. Here’s what to do when you run into trouble.

  • Getting Lots of Nulls: If you change a field from a String to a Number and suddenly see a lot of "Null" values, it means some of the original string values couldn't be converted. For example, trying to convert "N/A" or "pending" text to a number will fail. Go back to your original data source (or use the Data Source viewer in Tableau) to inspect for non-numeric text values in the column and clean them up.
  • Maps Aren't Working (Geographic Role Issues): You've assigned the 'Country' role to your field, but cities aren't appearing on the map. This usually happens when Tableau can't recognize some of your location names. For instance, Tableau knows "United Kingdom" but might be ambiguous about "UK". You can fix this by clicking the little gray indicator in the bottom right of the map that says "# unknown", and from there you can correct ambiguous locations or match them manually.
  • "Type Mismatch" Error in Calculations: If you try to create a calculated field like [Sales] > "1000" and you get a type mismatch error, it likely means your [Sales] field is a string, not a number. You can’t compare a string to a number. Fix this by changing the data type of the [Sales] field to Number, and your calculation will work: [Sales] > 1000.

Final Thoughts

Changing data types is a fundamental skill in Tableau that bridges the gap between raw data and actionable dashboards. Whether you're making corrections on the Data Source page for a clean start, in the Data pane for a quick fix, or using calculated fields to tackle complex transformations, mastering this skill is essential for accurate analysis.

This process of data prep - checking types, cleaning columns, connecting sources - is where a lot of manual reporting hours get lost. We built Graphed to dramatically simplify this. By connecting directly to your tools like Google Analytics, Shopify, or Salesforce, we handle much of the data prep for you and let you create entire dashboards using plain English. Instead of getting hung up on why your dates are strings, you can just ask, "Show me my sales revenue by month for the last year," and get an interactive chart in seconds.

Related Articles