0
0
Tableaubi_tool~5 mins

Type conversion functions in Tableau - Step-by-Step Guide

Choose your learning style9 modes available
Introduction
Type conversion functions in Tableau help you change data from one type to another. This is useful when your data is not in the right format for calculations or visualizations.
When your date is stored as text and you want to use it in a timeline chart
When numbers are stored as text and you want to perform math operations on them
When you want to convert a number to text to combine it with other text fields
When you need to change a string to a date to filter data by date ranges
When you want to ensure data types match for joining tables
Steps
Step 1: Open your Tableau workbook
- Data pane
You see your data fields listed
💡 Make sure your data source is connected and loaded
Step 2: Click the drop-down arrow next to a field you want to convert
- Data pane
A menu appears with options for the field
💡 Choose a field that needs type conversion, like a string date
Step 3: Select 'Create Calculated Field'
- Field drop-down menu
A calculation editor window opens
💡 This is where you write your type conversion formula
Step 4: Type the conversion function, for example: DATE([YourField])
- Calculation editor
The field will convert text to date format
💡 Use INT() to convert to integer, STR() to convert to string, FLOAT() for decimal numbers
Step 5: Click OK to save the calculated field
- Calculation editor
The new converted field appears in the Data pane
💡 Use this new field in your visualizations
Before vs After
Before
Field 'Order Date' is stored as text like '2023-06-01', calculations on dates fail
After
New calculated field 'Order Date (Date)' converts text to date format, allowing date filters and charts
Settings Reference
DATE()
📍 Calculation editor
Convert text or numbers to date format
Default: N/A
INT()
📍 Calculation editor
Convert values to whole numbers
Default: N/A
FLOAT()
📍 Calculation editor
Convert values to decimal numbers
Default: N/A
STR()
📍 Calculation editor
Convert values to text format
Default: N/A
Common Mistakes
Using DATE() on a string that is not in a recognizable date format
Tableau cannot convert invalid date strings and returns null
Ensure the string matches a date format like 'YYYY-MM-DD' before using DATE()
Trying to convert text with letters to INT() or FLOAT()
Non-numeric text cannot convert to numbers and causes errors
Clean or filter data to remove non-numeric text before conversion
Summary
Type conversion functions change data types to make data usable in calculations and visuals
Common functions include DATE(), INT(), FLOAT(), and STR()
Always check your data format before converting to avoid errors