Last Modified Date: 29 Nov 2023
Environment
- Tableau Server
- Tableau Desktop
Answer
The following instructions can be reviewed in the attached workbook.- Select Analysis > Create calculated field....
- In the Formula text box, type the formula similar to the one below, and then click OK.
DATEPART('year', [<date-field>])
- Drag the calculated field into the view, replacing the original date field.
Additional Information
DATEPART
returns the date as an integer. For months or days of the week, use DATENAME
instead of DATEPART
. For example:
DATENAME('month', [<date-field>])Or:
DATENAME('weekday', [<date-field>])
DATENAME returns the name of the specific date part as a discrete string. For displaying the date as yyyy/mm/dd format, use DATETRUNC. For example:
1. Create a calculated field.
DATE(DATETRUNC('month',[Order Date]))2. Add the field to the view.
For Windows, keep right-clicking the filed and drag to Rows or Columns.
For Mac, keep pushing option key and drag the field to Rows or Columns.
3. Select <field name> (Continuous) or <field name> (Discrete) in the option menu as you need.For Mac, keep pushing option key and drag the field to Rows or Columns.
To voice your support for the inclusion of this feature request in a future product release, add your vote to the following Community Idea: Ability to disable one-click drill-down.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials