Tableau Date Calculations
Tableau can provide a large number of inbuilt functions such as dates. Dates are one of the critical fields which are extensively used in most of the data analysis.
You can manipulate the simple date such as adding or subtracting days from a date. Also, you can create complex expressions that include dates.
Here are the steps to create a calculation field and use date functions in it.
How to create a calculated field
Calculation Editor in Tableau
The above process opens a calculation editor that lists all the functions available in Tableau.
You can change the dropdown value and only see the related functions to date, shown in the below image:
Create a Formula
If you want to find out the Sales volume along with the difference in the date of sales in months from 15/06/2015 to 15/02/2015, create the formula as shown in the below image.
Using the Calculated Field
To see the created field in graphical representation, you can drag Month and date_diff field into the Rows shelf and drag the Sales field to the Columns shelf. Also, drag the ship Date with months.
The below screenshot shows the Sales volume along with the difference in the date of sales: