May 26, 2021 Tableau
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.
When you connect to the sample supermarket, go to the analysis menu and click Create a calculated field, as shown in the following image.
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.
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.
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.