Data Types and Operators in Tableau
Data Types in Tableau
 In Tableau, data types define the nature of the values stored in fields and columns.
 Understanding data types is crucial for proper data analysis, visualization, and manipulation within Tableau.
 Automatic or Dynamic Data Type :
 Tableau automatically assigns data types to fields based on the data source and its inferred structure. However, users can manually override data types as needed.
 Data Type Conversion:
 Tableau allows users to convert data types as per need within calculated fields or during data preparation using functions like INT(), STR(), DATE(), etc.
(A) Some common & broad categories of data types supported by Tableau are:
1. Numeric Data Types: These include

 Integer (Whole Number): Represents whole numbers without decimal points.
 Float (FloatingPoint Number): Represents numbers with decimal points.
 Decimal: Precise numeric values with fixed decimal precision.
2. String Data Types: These include

 String (Text): Represents text or alphanumeric characters.
 Char (Character): Fixedlength character string.
 Varchar (Variable Character): Variablelength character string.
3. Date and Time Data Types: These include

 Date: Represents dates without time information.
 DateTime (Date and Time): Represents both date and time information.
 Time: Represents time information without dates.
 Timestamp: Represents date and time with timezone information.
4. Boolean Data Type: These include

 Boolean (Logical): Represents true or false values.
5. Geographic Data Types: These include

 Latitude: Represents the latitude coordinate.
 Longitude: Represents the longitude coordinate.
 Geographic Role: Tableau provides specific geographic roles for geographic data, such as country, state, city, etc.
6. Other Data Types: These include

 Binary: Represents binary data, such as images or files.
 Object: Represents any data type that cannot be classified into other specific types.
(B) Additional Data Type in Tableau:

 Discrete vs. Continuous:
 In Tableau, data types can be further categorized as discrete or continuous.
 Discrete data types represent distinct, separate values (e.g., integers, dates), while continuous data types represent a range of values (e.g., floats, time durations).
 Discrete vs. Continuous:
Operators in Tableau
 In Tableau, operators are symbols or keywords used to perform specific operations or comparisons on data in expressions, calculations, or conditions.
 These are some of the commonly used operators in Tableau. They are used in calculated fields, filters, and other expressions to perform calculations, comparisons, and logical operations on data.
 Some common operators used in Tableau are as follows:

 Arithmetic Operators:
 Addition (+): Used to add two values together.
 Subtraction (): Used to subtract one value from another.
 Multiplication (*): Used to multiply two values.
 Division (/): Used to divide one value by another.
 Modulus (%): Returns the remainder of the division of one value by another.
 Comparison Operators:
 Equal to (=): Compares two values for equality.
 Not equal to (<> or !=): Compares two values for inequality.
 Greater than (>): Checks if one value is greater than another.
 Less than (<): Check if one value is less than another.
 Greater than or equal to (>=): Checks if one value is greater than or equal to another.
 Less than or equal to (<=): Checks if one value is less than or equal to another.
 Logical Operators:
 AND: Returns true if both conditions are true.
 OR: Returns true if at least one of the conditions is true.
 NOT: Negates the result of a condition.
 String Operators:
 + CONCATENATION: Concatenates two or more strings.
 CONTAINS: Checks if a string contains a specified substring.
 STARTSWITH: Checks if a string starts with a specified prefix.
 ENDSWITH: Checks if a string ends with a specified suffix.
 LIKE: Performs a pattern match comparison on strings.
 Date & Time Operators:
 DATEDIFF: Returns the difference between two dates.
 DATETRUNC: Truncates a date to a specified level of granularity (e.g., year, month).
 DATEADD: Adds a specified interval to a date.
 Aggregate Operators:
 SUM(): Returns the sum of a set of values.
 AVG(): Returns the average of a set of values.
 MIN(): Returns the minimum value in a set.
 MAX(): Returns the maximum value in a set.
 COUNT(): Returns the count of nonnull values in a set.
 Set Operators:
 UNION Combines two sets of data
 INTERSECT Returns the intersection of two sets of data
 EXCEPT Returns the difference between two sets of data
 Conditional Operators:
 IF Conditional statement that returns one value if a condition is true and another value if it’s false
 Case Statement:

CASE Statement is used for conditional logic similar to the switchcase statement in programming languages


Table Calculation Operators:

WINDOW_SUM: Calculates a sum across a specified window of data.

RUNNING_SUM: Calculates a running sum of values in a specified order.

 Arithmetic Operators:
0 Comments