Date calculations in Tableau

by Ana-Casiana Tarita

Date calculations are extremely important for data analysis and interpretation. To create a date calculation simply click to Create Calculated field and select Date.

For example, you can separate the orders that were delivered late from the orders that were delivered on time by just adding a simple calculation rather than calculate them manually by hand ( see example 1) .

In this example we used the DATEDIFF calculation along with a separate calculation for [deadline] to separate the orders that were 'not late' from the late orders.

You can also use Calculated field to calculate KPIs. In the following example, we filtered the year to 2021 and calculated the Prior year sales, max year sales and the difference LOD. ( see the example 2)

Max year sales

Another example of data calculation is when you want to create a Dynamic date that can go with the parameter created. In example 3, we can see that the DATETRUNC  calculation  was used so that the user can change dynamically between week/month/quarter and year.  

If the calculation was not used, the parameter would not work and the user would not be unable to change anything.