A powerful feature of Tableau Desktop is the ability to manipulate and transform date fields using calculated fields. This gives you flexible control over how dates are displayed, grouped, and used in your analysis.
In this post, we’ll look at four commonly used date functions in Tableau: DATENAME, DATEPARSE, DATEPART, and DATETRUNC, and explain what each one takes as input, what it returns, and when to use it.
Tip: You can access the full list of date functions directly in the Create Calculated Field window. Click the small arrow in the right of the editor, then choose Date from the dropdown list of functions.


1. DATENAME()
What it takes: a Date value
What it returns: a String
What you must specify: a date_part (e.g., 'day', 'month', 'quarter', 'year')
Explanation: DATENAME() returns the name of the part of the date you specify. This is useful when you want a text version of a date component.
Examples:
- DATENAME('month', #2024-10-15#) → "October"
- DATENAME('weekday', #2024-10-15#) → "Tuesday"
Use this when you want labels like January, Q4, or Monday.
2. DATEPARSE()
What it takes: a String
What it returns: a Date
What you must specify: the string format (e.g., 'dd.MMMM.yyyy', 'MM/dd/yyyy')
Explanation: DATEPARSE() converts a text string into a true date by telling Tableau what format the string is in.
This function is extremely useful when working with imported data where dates are stored as text rather than as actual date fields.
Example:
- String: "15-October-2024"
- Calculation: DATEPARSE('dd-MMMM-yyyy', [String Date]) → Date value equivalent to 2024-10-15
Use this when your dates are messy, inconsistent, or in a non-standard format.
3. DATEPART()
What it takes: a Date
What it returns: an Integer
What you must specify: a date_part (e.g., 'month', 'year', 'week', 'quarter')
Explanation: DATEPART() returns the numeric value of the specified date part.
Examples:
- Months → 1–12
- Weekdays → 1–7
- Quarters → 1–4
Examples:
- DATEPART('month', #2024-10-15#) → 10
- DATEPART('quarter', #2024-10-15#) → 4
Use this when you need a number for calculations or filtering (e.g., “month = 10”).
4. DATETRUNC()
What it takes: a Date
What it returns: a Date (truncated to the specified level)
What you must specify: a date_part (e.g., 'month', 'quarter', 'year')
Explanation: DATETRUNC() cuts a date down to the start of whatever unit you specify. This is useful for grouping data into consistent time periods.
Examples:
- DATETRUNC('month', #2024-10-15#) → 2024-10-01
- DATETRUNC('quarter', #2024-10-15#) → 2024-10-01 (the first day of Q4)
Use this when you want all dates within the same time period to align to the same starting point.
Common uses:
- Cohort analysis
- Time series grouping
- Monthly or quarterly aggregations
