Tableau Date Functions

Tableau Date Functions with Examples

Dates are crucial fields which are widely used in data analysis. Hence, Tableau provides a large number of inbuilt date functions that allows you to manipulate dates in your data source. You can simply add or subtract days from a date or can create complex expressions involving dates. You can also create new date values with a specified date function, by using the DATETRUNC function. Create Calculated Field
  1. In the Tableau Desktop, connect to the Excel file named Facebook Data which is saved in the data source.             Tableau Date Functions
  2. Navigate to the worksheet pane and click on Analysis > Create Calculated Field as shown below.
Tableau Date Functions
  1. You will notice that a new dialogue box has appeared. Click on the icon present on the rightmost side of the box.
Tableau Date Functions
  1. You can see a tab linked with the previous one which lists all the functions that are available in Tableau.
Tableau Date Functions
  1. Further, you can change the dropdown value and choose only the functions that are related to Date.
Tableau Date Functions
  1. On the rightmost side of the pane, you will notice that Tableau is briefing us with the formula and small explanation for the selected functions.

Create a Formula

Now, find out the sales volume along with the addition to the date of sales in months from 12st March 2018. For this, we will use the ‘DATEADD’ Date function and will create the formula as shown in the following screenshot. Also, change the name to DateAdd. And click on OK. Tableau Date Functions In the Data pane, under Dimensions, you will notice a field has been created named Date_Add.

Applying the Calculated Field

The above-calculated field can be applied in the view by dragging it to the Rows and drag the Sales field to the Columns shelf. Also, drag the Date with months. The following screenshot shows the Sales values. Tableau Date Functions