Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Tableau date calculation


May 26, 2021 Tableau


Table of contents


Date is one of the key fields that is widely used in most data analysis scenarios. /b10> As a result, Tableau provides a number of built-in functions that involve dates. /b11> We can do simple date operations, such as adding or subtracting days from dates. /b12> We can also create complex expressions that involve dates.

Here are the steps to create a calculated field in which you can use the date function.

Create a calculated field

When you connect to the sample supermarket, go to the analysis menu and click Create a calculated field, as shown in the following image.

Tableau date calculation

The calculation editor

The steps above open the calculation editor, which lists all the features available in Tableau. /b10> You can change the down-list value to see only date-related features.

Tableau date calculation

Create a formula

Let's find out the difference between sales volume and date of sale in the month beginning March 21, 2009. To do this, we create a formula like the one shown below.

Tableau date calculation

Use calculated fields

Now that we see the created field in action, we can drag it to the shelf and the sales field to the column rack. /b10> Also drag the ship date and month. /b11> The following image shows the sales value.

Tableau date calculation