Popular Searches
Popular Course Categories
Popular Courses

Converting Data Types

Dimensions, Measures, and Data Types

Converting Data Types in Tableau – Complete Detailed Notes

Converting data types in Tableau is an important data preparation skill that helps users ensure their data is interpreted correctly before creating visualizations, dashboards, reports, and analytical calculations. It involves changing a field from one data type to another, such as converting text into dates, numbers into strings, or decimal values into whole numbers.

Correct data types help Tableau perform calculations accurately, display dates properly, create meaningful visualizations, and organize fields into dimensions and measures. Understanding data type conversion is essential when working with Excel files, CSV files, databases, and other data sources.

Course Link: JustAcademy Tableau Training

Demo Link: Register for a Tableau Course Demo


1. Learning Objectives

After studying this topic, you will be able to:

  • Understand what data type conversion means in Tableau.
  • Identify common Tableau data types.
  • Change a field's data type using the Data Source page and worksheet.
  • Convert text fields into numbers and dates when the values are compatible.
  • Understand the difference between changing a field's data type and converting values inside a calculation.
  • Recognize common conversion errors and troubleshoot them.
  • Use data type conversion in practical business reporting scenarios.

2. What Is a Data Type?

A data type defines the kind of information stored in a field and how Tableau should interpret that information. For example, a field containing product names should generally be treated as text, while a field containing sales amounts should be treated as numeric data.

Tableau uses data types to determine which operations are available for a field. Numeric fields can be used in mathematical calculations, date fields support date-based analysis, and geographic fields can help create maps.

Examples of Data Types

Field Name Example Value Suitable Data Type Typical Use
Customer Name Rahul Sharma String Customer identification
Sales 25000.50 Number (Decimal) Revenue calculations
Quantity 15 Number (Whole) Product quantity analysis
Order Date 2026-10-14 Date Monthly and yearly reporting
Order Timestamp 2026-10-14 10:30:00 Date & Time Time-based analysis
Customer ID CUST001 String Customer identification
Profit Margin 0.25 Number (Decimal) Profitability analysis

Important: A field containing digits is not always a number. For example, a customer ID such as 00125 may need to remain a string because it identifies a customer rather than representing a quantity.


3. What Is Data Type Conversion?

Data type conversion is the process of changing how Tableau interprets a field or value. For example, a CSV file may contain sales values stored as text. Converting the field to a numeric type allows Tableau to perform mathematical operations on compatible values.

Examples

  • String to Number: Convert "1500" into the numeric value 1500.
  • String to Date: Convert a compatible date string into a date value.
  • Number to String: Convert a numeric identifier into text when it should be treated as a label.
  • Date & Time to Date: Use the date portion when the time component is not required for the analysis.
  • Decimal to Whole Number: Convert a decimal field into an integer when whole-number values are appropriate.

Conversion is successful only when Tableau can interpret the original values as the target data type. Invalid or inconsistently formatted values may produce nulls or conversion errors, depending on the method used.


4. Common Data Types in Tableau

4.1 String (Text)

String data represents text, labels, names, codes, and identifiers. Strings can contain letters, numbers, spaces, and symbols.

Examples: "Mumbai", "Product A", "00125", and "INR 500".

Common use cases: Customer names, product categories, order IDs, postal codes, and descriptive labels.

4.2 Number (Whole)

Whole-number data represents integers without a fractional component.

Examples: 10, 250, and -5.

Common use cases: Item counts, employee counts, units sold, and other integer-valued measurements.

4.3 Number (Decimal)

Decimal data represents numbers that can contain a fractional component.

Examples: 1250.75, 98.6, and 0.25.

Common use cases: Sales, costs, profit margins, percentages stored as fractions, and measurements.

4.4 Date

Date data represents calendar dates without requiring a time component.

Examples: 2026-10-14 and 14-Oct-2026, when recognized by Tableau as valid dates.

Common use cases: Order dates, hiring dates, invoice dates, and delivery dates.

4.5 Date & Time

Date & Time data represents both a calendar date and a time of day.

Example: 2026-10-14 10:30:00.

Common use cases: Transaction timestamps, login records, delivery events, and event monitoring.

4.6 Boolean

Boolean data represents a logical value such as True or False. It is useful for conditions and classifications.

Examples: Is Active, Is Returned, and Is Target Customer.

4.7 Geographic Roles

Tableau can assign geographic roles to fields such as country, state, city, and postal code. Geographic roles help Tableau interpret location values for mapping. A geographic role is not simply a replacement for the underlying data type; it adds geographic meaning to a compatible field.


5. Why Is Data Type Conversion Important?

  • Accurate calculations: Numeric values must be interpreted correctly for sums, averages, ratios, and other calculations.
  • Correct date analysis: Recognized dates support year, quarter, month, and day-based analysis.
  • Better visualizations: Tableau uses data types to determine how fields can be placed and displayed in a view.
  • Improved data quality: Converting fields helps identify values that are incorrectly formatted or inconsistent.
  • Reliable filtering: Correct data types make it easier to apply relevant filters, such as date ranges or numeric thresholds.
  • Consistent reporting: Standardized types help maintain consistency across charts, dashboards, and calculations.

Example: Sales Stored as Text

Suppose a dataset contains the following sales values:

Original Value Stored As Problem
1000 String May not behave as a numeric measure.
2500 String Cannot reliably be used as a numeric value until interpreted correctly.
1750 String Numeric aggregation may be unavailable or inappropriate.

After converting valid values to a numeric type, Tableau can calculate the total sales as 5250. If the values contain currency symbols, thousands separators, or other text, they may need cleaning before conversion.


6. How to Change a Data Type in Tableau

Tableau provides ways to change the data type of a field. The exact options available may depend on the data source, field, and Tableau version.

Method 1: Change the Data Type on the Data Source Page

  1. Open Tableau Desktop or Tableau Public and connect to a data source.
  2. Open the Data Source page.
  3. Locate the column whose data type you want to change.
  4. Click the data type icon beside the field name.
  5. Choose a suitable type, such as String, Number (Whole), Number (Decimal), Date, or Date & Time.
  6. Review the displayed values and confirm that Tableau has interpreted them correctly.
  7. Open a worksheet and test the field in a simple visualization or calculation.

Example: If the Sales column contains values such as 1200 and 3500 but is recognized as text, change it to a suitable numeric type after checking that its values are valid numbers.

Method 2: Change the Data Type from the Data Pane

  1. Open a worksheet.
  2. Find the field in the Data pane on the left.
  3. Click the field's data type icon or open its context menu.
  4. Select the available data type option.
  5. Choose the intended data type.
  6. Check the field's behavior in the worksheet.

The options shown may differ depending on the field and connection. If the required option is not available, try changing the type on the Data Source page or using a calculated field.

Method 3: Convert Values with a Calculated Field

A calculated field can explicitly convert compatible values as part of a calculation. This is useful when the original field should remain unchanged or when you want to create a separate cleaned field.

To create one, open a worksheet, choose Analysis → Create Calculated Field (or use the corresponding option in your Tableau version), enter a name and formula, and validate the expression.


7. Converting String to Number

String-to-number conversion is common when numerical data is imported from text files, spreadsheets, or databases with an incorrect type.

Example Dataset

Product Sales as Text
Laptop 45000
Mobile 25000
Keyboard 1500

If Sales as Text is a string field, create a calculated field using a suitable numeric conversion function.

INT([Sales as Text])

Use INT() when a whole-number result is appropriate. For values that can contain decimal places, use FLOAT() instead:

FLOAT([Sales as Text])

For valid values in the example, the converted values are numeric and can be aggregated. Always test how the chosen function handles invalid or decimal-containing values before using it in a production report.

Important Considerations

  • INT() produces a whole-number result and is not appropriate when preserving fractional precision is required.
  • FLOAT() is appropriate for values that need a floating-point numeric representation.
  • Values containing symbols or unexpected characters may not convert as intended.
  • Do not convert identifiers into numbers merely because they contain digits.

8. Converting String to Date

Date values are sometimes imported as strings, especially when source data contains dates in a nonstandard format. A string must be recognized or parsed into a date value before reliable date-based analysis can be performed.

Example

Order Date as Text Intended Meaning
2026-01-15 15 January 2026
2026-02-20 20 February 2026
2026-03-10 10 March 2026

For a string in a format Tableau can recognize, try:

DATE([Order Date as Text])

If the field includes date and time information and you need the date portion, DATE() may be suitable when the input is compatible.

When the Date Format Is Not Recognized

If a source uses a format such as 15/01/2026, 01-15-2026, or a text month name, confirm that Tableau interprets the day and month correctly. Different formats can be ambiguous. Clean or standardize the source values when necessary, and validate the converted results against known dates.

Practical check: After conversion, place the field in a worksheet and inspect its date levels, such as Year, Quarter, Month, and Day. Verify several records rather than relying only on the field icon.


9. Converting Number to String

Sometimes a number is a label or identifier rather than a quantity. In that situation, converting it to a string can help prevent accidental aggregation and preserve its role as a categorical field.

Example: Employee ID

Employee ID Why String May Be Appropriate
1001 Identifies an employee.
1002 Is not a quantity to sum.
1003 May need to display as a label.

Use a calculated field when an explicit conversion is required:

STR([Employee ID])

The resulting values can be used as text labels. If an identifier has leading zeros, such as 00125, those zeros may already have been lost if the source imported it as a number. Converting it back to a string cannot reliably restore the original zeros; preserve such identifiers as text in the source or clean them using a defined rule.


10. Converting Date & Time to Date

Some datasets store timestamps that include both a date and a time. If the analysis is focused on calendar dates rather than individual times, a date-only field may be easier to use.

Example

Original Timestamp Date Portion
2026-10-14 09:15:00 2026-10-14
2026-10-14 12:45:00 2026-10-14
2026-10-15 08:30:00 2026-10-15

A compatible date-time field can be converted with:

DATE([Order Timestamp])

This can help group multiple transactions by calendar date. Keep the original timestamp if the time of day is important for hourly reporting, event sequencing, or operational analysis.


11. Converting Decimal to Whole Number

Decimal-to-whole-number conversion is useful when a field should contain integers, but the result must be chosen carefully. Changing a decimal field to a whole-number type can remove fractional precision or otherwise alter the represented values.

Example

Original Value Potential Whole-Number Result Consideration
12.7 12 using an integer conversion such as INT() Fractional part is lost.
8.9 8 using INT() Do not assume it rounds to 9.
15.0 15 No fractional information is lost.

In Tableau calculations, INT() converts a numeric value to an integer; do not treat it as a general rounding function. If the business requirement is to round to the nearest integer, choose an appropriate rounding calculation instead and verify the expected behavior.

Best practice: Keep decimal precision for currency, rates, percentages, and measurements unless the business definition explicitly requires a whole-number result.


12. Useful Tableau Conversion Functions

Tableau provides functions that can convert values within calculated fields. Their behavior depends on the input and the function, so validate the results with representative data.

Function Purpose Example
INT() Converts a compatible value to an integer. INT([Quantity Text])
FLOAT() Converts a compatible value to a floating-point number. FLOAT([Sales Text])
STR() Converts a compatible value to a string. STR([Customer Number])
DATE() Converts a compatible expression to a date value. DATE([Order Timestamp])
DATETIME() Converts a compatible expression to a date-time value. DATETIME([Timestamp Text])
DATEPARSE() Parses a string using a specified date format where supported. DATEPARSE("dd/MM/yyyy", [Date Text])

Note about DATEPARSE(): Support can depend on the data source and connector. If it is unavailable for a connection, standardize the date in the source or use a supported alternative. Make sure the format string matches the actual input.


13. Using DATEPARSE() for Custom Date Formats

When a date is stored as text and the format is known, DATEPARSE() can be useful in supported connections.

Example Dataset

Date Text Format
14/10/2026 Day/Month/Year
25/11/2026 Day/Month/Year

Example calculated field:

DATEPARSE("dd/MM/yyyy", [Date Text])

The format pattern dd/MM/yyyy tells Tableau how to interpret the text. Check the results to ensure that the day and month are not reversed.

Common Date Format Tokens

Token Meaning Example
dd Day of month 14
MM Month number 10
yyyy Four-digit year 2026
HH Hour in a 24-hour format 16
mm Minute 30
ss Second 45

Use the exact pattern expected by the function and the relevant Tableau connection. Date parsing patterns and support may vary; consult Tableau's function documentation for the applicable environment.


14. Data Type Conversion vs. Formatting

Changing a field's data type is different from changing how a value is displayed. Formatting affects presentation, while conversion changes how Tableau interprets the value.

Aspect Data Type Conversion Formatting
Purpose Changes the type used to interpret a field or value. Changes how the value appears.
Example String to Number (Decimal). Display a number as currency.
Calculation impact Can change which operations are supported and how values behave. Usually changes appearance, not the underlying numeric value.
Date example Convert text into a recognized date. Display a recognized date as 14-Oct-2026.
Typical use Correcting data interpretation. Improving readability of reports.

For example, applying a currency format to a string containing "2500" does not itself guarantee that the field becomes a numeric measure. Convert the field to a compatible number first, then apply the desired number format.


15. Data Type Conversion and Dimensions/Measures

Tableau often organizes fields into Dimensions and Measures. Dimensions are commonly used to categorize or segment data, while measures are commonly used for quantitative analysis. Data type and field role are related, but they are not the same thing.

  • String fields: Often used as dimensions, such as Product Name or Region.
  • Numeric fields: May be measures, such as Sales or Profit, or dimensions, such as an ID or category code.
  • Date fields: Can be used to group and filter records by time periods.
  • Geographic fields: Can be assigned geographic roles for mapping when their values are appropriate.

After converting a field, check whether its dimension/measure role is appropriate for the analysis. A numeric customer ID should not automatically be summed merely because it is stored as a number.


16. Common Data Type Conversion Problems

Problem 1: Numeric Values Contain Symbols

Example: ₹1,500 or $2,500.50 is stored as text.

Why it happens: Currency symbols and separators may prevent direct numeric conversion.

Solution: Clean the values using an appropriate, tested transformation or correct the data in the source. Be careful with commas because their meaning varies by locale; a comma may indicate a thousands separator or a decimal separator.

Problem 2: Invalid Date Values

Example: 2026-15-40.

Why it happens: The string does not represent a valid calendar date.

Solution: Validate source values, standardize the date format, and investigate invalid records rather than silently assuming the conversion succeeded.

Problem 3: Leading Zeros Disappear

Example: 00045 becomes 45.

Why it happens: The source value was interpreted as a number rather than an identifier.

Solution: Preserve identifier columns as strings at import time whenever possible. If the original zeros have already been lost, restore them only using a reliable rule or original source.

Problem 4: Decimal Precision Is Lost

Example: A value such as 125.75 is converted to a whole number.

Why it happens: The chosen target type cannot preserve the fractional component.

Solution: Use a decimal type when the fraction is meaningful. Convert to whole numbers only when the business requirement supports it.

Problem 5: Null Values Appear After Conversion

Why it happens: Some source values may be blank, malformed, inconsistent, or incompatible with the requested type.

Solution: Inspect the source values, check conversion rules, and distinguish genuine missing values from invalid data. Do not automatically replace every null with zero or a default date, as this can distort analysis.

Problem 6: Date and Month Are Misinterpreted

Example: 04/05/2026 may mean 4 May or April 5, depending on the format.

Solution: Confirm the source convention and explicitly parse the string using the correct pattern where supported. Validate against known records.


17. Best Practices for Converting Data Types

  1. Inspect the data first: Review sample values before changing a field's type.
  2. Choose types based on meaning: An ID is usually a label, while a sales amount is a quantity.
  3. Preserve the original field: When data quality is uncertain, create a separate calculated field so the original remains available for comparison.
  4. Validate converted results: Check representative records, totals, null counts, and date ranges.
  5. Handle invalid values deliberately: Clean or flag malformed values instead of hiding them.
  6. Protect precision: Avoid converting currency, rates, or measurements to whole numbers without a clear reason.
  7. Standardize dates: Use consistent date formats and confirm locale assumptions.
  8. Check downstream views: Review calculations, filters, sorting, and charts after changing a field.
  9. Document important transformations: Explain why the conversion was made and how exceptional values are handled.
  10. Test refreshes: Confirm that the conversion continues to work when new data is added.

18. Practical Example: Cleaning a Sales Dataset

Imagine a retail company imports a CSV file with the following fields:

Order ID Order Date Text Sales Text Quantity Text Region
ORD001 2026-01-10 1500.50 2 West
ORD002 2026-01-11 2500.00 5 North
ORD003 2026-01-12 750.25 1 South

Step 1: Inspect the Fields

Check whether Tableau recognizes the order date as a date, sales as a decimal number, quantity as a whole number, and order ID and region as strings.

Step 2: Convert the Sales Field

If Sales Text is a string and all values follow a compatible numeric format, create a calculated field:

FLOAT([Sales Text])

Name the field Sales (Converted).

Step 3: Convert Quantity

If quantities are valid integer strings, create:

INT([Quantity Text])

Name the field Quantity (Converted).

Step 4: Convert the Order Date

If the date text is compatible with Tableau's date interpretation, create:

DATE([Order Date Text])

Name the field Order Date (Converted) and confirm the dates are correct.

Step 5: Build a Visualization

  1. Place Order Date (Converted) on Columns.
  2. Place Sales (Converted) on Rows.
  3. Choose an appropriate date level, such as Month or Day.
  4. Use Region as a color or filter field.
  5. Check the sales total against the source data.

Expected Outcome

The cleaned fields can support a sales trend chart, quantity analysis, and regional comparisons. The calculated fields also leave the original text fields available for validation.


19. Practice Exercises

Try these exercises in Tableau using a sample dataset.

  1. Convert a text field containing 100, 250, and 400 into a numeric field and calculate the total.
  2. Convert a compatible string date field into a recognized date and create a monthly sales chart.
  3. Convert an employee number into a string and use it as a label instead of a measure.
  4. Convert a date-time field into a date-only field and compare daily transaction totals.
  5. Identify a dataset containing invalid numeric or date values and document how you handle them.
  6. Compare a formatted numeric field with a field that has actually been converted from text to a number.
  7. Check how converting a decimal field to an integer affects the displayed values and aggregate totals.

Exercise Answers and Hints

  • Exercise 1: Use a compatible numeric conversion, such as INT() for whole-number values or FLOAT() for decimal values, then validate the sum.
  • Exercise 2: Use DATE() for compatible inputs or a supported parsing method for custom formats.
  • Exercise 3: Use STR([Employee Number]) if a calculated conversion is needed.
  • Exercise 4: Use DATE([Date Time Field]) for compatible date-time values.
  • Exercise 5: Inspect invalid values and decide whether to clean, flag, or exclude them based on the reporting requirements.
  • Exercise 6: Formatting changes appearance; conversion changes how Tableau interprets a value.
  • Exercise 7: Compare the original decimal values with the converted results and confirm whether precision loss is acceptable.

20. Interview Questions and Answers

Q1. What is data type conversion in Tableau?

Answer: It is the process of changing the data type of a field or converting values into another type so Tableau interprets them correctly for calculations, filtering, and visualization.

Q2. Why is data type conversion necessary?

Answer: It helps ensure that values are interpreted according to their meaning, enabling valid numeric calculations, date analysis, and appropriate visualization behavior.

Q3. How can you change a field's data type in Tableau?

Answer: You can use the data type icon or field menu on the Data Source page or Data pane, depending on the field and connection. You can also use a calculated field for explicit conversions.

Q4. Which function converts a value to a string?

Answer: STR() converts a compatible value into a string.

Q5. Which function can convert a compatible value to an integer?

Answer: INT() converts a compatible value to an integer. It should not be confused with rounding to the nearest integer.

Q6. What is the difference between INT() and FLOAT()?

Answer: INT() returns an integer, while FLOAT() returns a floating-point numeric value that can represent decimal fractions.

Q7. How can you convert a compatible value into a date?

Answer: Use DATE() for compatible expressions. For a text date in a custom format, DATEPARSE() may be appropriate where supported.

Q8. What is the difference between data type conversion and formatting?

Answer: Conversion changes how Tableau interprets the value; formatting changes how the value is displayed.

Q9. Why should customer IDs often remain strings?

Answer: IDs identify records rather than represent quantities. Keeping them as strings helps preserve leading zeros and avoids meaningless aggregations.

Q10. What can cause nulls after conversion?

Answer: Invalid, missing, or inconsistently formatted source values can prevent a conversion from succeeding as expected. The underlying values and conversion method should be checked.

Q11. How do you convert a date-time field to a date-only value?

Answer: Use DATE([Date Time Field]) when the input is compatible, then verify the resulting dates.

Q12. What should you check after converting a field?

Answer: Verify sample values, nulls, totals, date ranges, field roles, filters, and any visualizations or calculations that depend on the field.


21. Quick Revision Notes

  • A data type tells Tableau how to interpret a field or value.
  • Common types include String, Number (Whole), Number (Decimal), Date, Date & Time, and Boolean.
  • Use a numeric type for values intended for mathematical analysis.
  • Use strings for labels and identifiers, even when they contain digits.
  • Use INT() for integer conversion and FLOAT() for floating-point numeric conversion.
  • Use STR() to convert a compatible value to text.
  • Use DATE() for compatible date conversion and DATEPARSE() for supported custom date formats.
  • Formatting and data type conversion are different operations.
  • Always validate converted values, particularly dates, currency fields, and identifiers.
  • Preserve the original field when the conversion requires data cleaning or business assumptions.

22. Final Checklist

  • ☐ I can identify the correct data type for common Tableau fields.
  • ☐ I can change a field's data type using the Data Source page or Data pane.
  • ☐ I can create a calculated field to convert compatible strings into numbers.
  • ☐ I understand how to convert compatible text values into dates.
  • ☐ I know why IDs and postal codes may need to remain strings.
  • ☐ I understand the difference between converting data and formatting it.
  • ☐ I can recognize invalid values, nulls, ambiguous dates, and potential precision loss.
  • ☐ I can verify converted fields in a worksheet before using them in a dashboard.

23. Conclusion

Converting data types in Tableau is a foundational data preparation technique. Correct conversion helps Tableau interpret fields appropriately, perform reliable calculations, analyze dates, and produce meaningful visualizations. The best approach is to choose a data type based on the meaning of the data, inspect source values before conversion, and validate the results afterward.

For further learning, explore JustAcademy Tableau Training and Register for a Tableau Course Demo.

whatsapp