## Introduction

Type Conversion Functions will be the topic of our next Tableau Essentials tutorial on functions. This set of functions allows to add the output of every operation to a different data type. These would be useful for getting the most of the the visualizations by prepping some variables for computation or if the supporting information source requires extra research and planning.

## Types

We could transform distinct parameters to multiple databases to use these functions. We can even use the Date or Datetime function to check that almost all of the elements in a dataframe are date or datetime types of data.

### DATE Function

The Date function is to convert a date from an integer, string, or date statement.

Syntax:

DATE(expression)

### DATETIME Function

The Datetime function, like the Date function before it, goes it a stage further with restoring a time component. You can get a datetime from a date, integer, or string once more.

Syntax:

DATETIME(expression)

### FLOAT Function

The Float function turns the value passed in as an input to a floating point integer.

Syntax:

FLOAT(expression)

### INT Function

The INT function will return an integers as its input. The INT function stops values to the nearest integer approaching zero for statements.

Syntax:

INT(expression)

### STR Function

The parameter will be returned as a string type of data by this function.

Syntax:

STR(expression)

## Use of type conversion functions

Type conversion functions allow you to convert fields from one data type to another. For example, you can convert numbers to strings, such as age values (numbers) to string values so that Tableau does not try to aggregate them.

## Create a type conversion calculation

Follow along with the steps below to learn how to create a type conversion calculation.

1. Access to the Samples – Superstore stored source of data that includes using Tableau in Tableau Desktop.
2. Go to a worksheet and click on it.
3. Select Analysis > Create Calculated Field.
4. In the calculation editor that opens, do the following:
• Name the calculated field, Postal Code String.
• Enter the following formula:
• STR([Postal Code])
• This calculation converts the Postal Code field from a number to a string.
• When you’re done, click OK.
• The new calculated field appears under Dimensions in the Data pane. Just like your other fields, you can use it in one or more visualizations.
• Converting this field from a number to a string ensures that Tableau treats it as a string and not a number (i.e. Tableau does not aggregate it).

## FAQ

### Q. What is Tableau?

Tableau is a predictive analytic solution that is redefining the ways we handle information to analyze challenges by enabling individuals and companies to get the most out of their data.

### Q. How do you change the datatype in Tableau?

To modify the file type of a column in a column, right-click the area in the Data panel, select Adjust Data Type, and afterwards select the most appropriate type of data from the drop-down list.

### Q. What is str in Tableau?

We can alter string data using string functions. We could, for example, have a field with all of the customers’ first and last identities. Ravi Kumar could be one of the members. To use a string function, we may extract all of the customers’ last names together into new field.

### Q. What is Zn function in Tableau?

Tableau’s ZN function works simply with numeric fields and sets Null to 0. ZN’s sole purpose is to convert Null integers to zero. It can be used for both row and aggregated values.

### Q. How do I convert a string to a date in Tableau?

In the Dimensions panel, right-click the date element and choose Create > Calculating Variable. Enter the DATEPARSE method in the dialogue. The structure and the string are the two primary components of the DATEPARSE function. The string represents the variable we want to transform, and it must be of the string data type.