One of the fundamental aspects of working with Tableau is understanding data types, as they define how data is stored and manipulated within the software. Choosing the correct data type ensures accurate calculations, appropriate visualisations, and efficient data processing.
What Are Data Types in Tableau?
Data types in Tableau define the nature of data within a field and determine how it interacts with different functions and visualisations. Tableau automatically assigns data types when a dataset is imported, but users can modify them as needed.
Common Data Types in Tableau
Tableau supports the following primary data types:
Data Type | Symbol | Description | Example Fields | Common Use Cases |
---|---|---|---|---|
String (Text) | Abc | Represents textual data | Customer Name, Product Category | Labels, Filters, Grouping |
Number (Whole) | # | Represents integer values | Order ID, Employee Count | Counting, Aggregations |
Number (Decimal) | # | Represents floating-point values | Sales Amount, Discount Rate | Calculations, Trends, Summarisations |
Date | Calendar Icon | Stores date values (YYYY-MM-DD) | Order Date, Shipment Date | Time-based Analysis, Trends |
Date & Time | Clock Icon | Stores both date and time values | Timestamp, Last Updated | Event Analysis, Log Monitoring |
Boolean | True/False | Represents binary values | Order Completed (Yes/No), Active Customer (True/False) | Conditional Logic, Filtering |
Geographic | Globe Icon | Stores location-based data | Country, City, Latitude, Longitude | Mapping, Geospatial Analysis |
Understanding Data Types with Examples
1. String Data Type (Text)
Example Field: Customer Name
- Used for labels, grouping, and filtering.
- Cannot be used for mathematical operations.
- Can be concatenated using functions like
+
orCONCAT
.
2. Number (Whole and Decimal)
Example Field: Sales Amount
- Whole numbers are used for counting entities like
Order ID
. - Decimal numbers are used for financial data, percentages, and ratios.
- Can be used for aggregations (SUM, AVG, MIN, MAX).
3. Date & Date-Time Data Type
Example Field: Order Date
- Essential for time-series analysis.
- Can be formatted as continuous or discrete fields.
- Used for creating trends, forecasting, and date-based calculations.
4. Boolean Data Type
Example Field: Order Completed
- Helps in defining conditions and filters.
- Can be used in calculated fields (e.g., IF statements).
5. Geographic Data Type
Example Field: City
- Enables geospatial analysis.
- Automatically recognises and maps geographical locations.
- Can be enriched with Latitude and Longitude for more precise visualisations.
Best Practices for Working with Data Types in Tableau
- Check Assigned Data Types: Always verify Tableau’s default data type assignments and adjust them as needed.
- Convert Data Types When Necessary: Use functions like
DATE()
,STR()
, andINT()
for conversions. - Use Correct Data Types for Filters and Calculations: Ensure numeric fields are not stored as text to avoid calculation errors.
- Optimise Performance: Using the right data type improves query execution and dashboard performance.