How to Format Date in Tableau
Working with dates in Tableau can feel like one of those "simple, but not easy" tasks. One minute you're dragging and dropping to create a beautiful time-series chart, and the next you're staring at a date format that looks nothing like what you wanted. This guide strips away the complexity and shows you how to format any date in Tableau, from quick automatic adjustments to precise custom layouts.
Understanding Dates in Tableau: Discrete vs. Continuous
Before jumping into formatting, it's essential to understand how Tableau sees dates. When you drag a date field onto a view, Tableau gives it one of two properties: Discrete (blue) or Continuous (green). This choice fundamentally changes how your dates are displayed and formatted.
Discrete Dates (Blue Pills): Think of these as individual, distinct categories. When you use a discrete date like
YEAR(Order Date), Tableau treats "2022," "2023," and "2024" as separate labels. These create headers in your view.Continuous Dates (Green Pills): These create a continuous timeline or axis. A continuous
YEAR(Order Date)plots dates along a single, unbroken axis, showing the flow of time. Gaps will appear for years with no data.
You can easily switch between them by right-clicking the date pill in your view and selecting the desired option from the bottom of the context menu. Knowing the difference is important because some formatting options are only available for one type or the other.
Method 1: The Quick and Easy Automatic Formats
For most day-to-day needs, Tableau's built-in date formats are more than enough. This is the fastest way to change how your dates appear in a chart, axis, or tooltip.
Let’s say you have a continuous date on your columns shelf showing monthly sales, but the axis displays as "January 2023," "February 2023," and so on. You want to simplify this to "Jan-23."
Here’s how to do it:
Right-click the date pill (the green one on your columns or rows shelf).
Select Format... from the menu. This opens the Format pane on the left side of your workspace.
In the Format pane, ensure you're on the "Header" or "Axis" tab.
Under the "Scale" section, you’ll find a dropdown menu for Dates.
Click the dropdown and you'll see a list of predefined formats like:
mm/dd/yyyy(03/15/2023)mmmm d, yyyy(March 15, 2023)mmm yyyy(Mar 2023)
Select the format that best fits your needs, and Tableau will instantly update your visualization.
This method is perfect for standard formatting and requires just a few clicks.
Method 2: Taking Control with Custom Date Formats
What if the preset list doesn't have the exact format you need? Perhaps your company uses a "Q1-2023" style for quarters, or you need to display the weekday in your date. This is where custom formatting comes in.
Follow the same first steps as above:
Right-click the date pill and select Format...
In the Format pane, click the Dates dropdown.
At the very bottom of the list, select Custom...
This opens a text box where you can type in your own format using Tableau’s date and time symbols. This gives you complete control over the final output.
Common Custom Date Symbols
Symbol | Meaning | Example |
y | Year |
|
q | Quarter |
|
m | Month |
|
d | Day |
|
h | Hour |
|
n | Minute |
|
s | Second |
|
Practical Custom Format Examples
Using the symbols above, you can build almost any format you can think of. Anything that isn’t a recognized symbol can be included by wrapping it in double quotes.
To get "Wed, Sep 20, 2023":
ddd, mmm dd, yyyyTo get military time with date:
mm/dd/yyyy hh:nn:ssTo display your company's fiscal quarter like "FQ3 23":
"FQ"q yyNote: The "FQ" text is wrapped in quotes to tell Tableau to treat it as literal text, not a format code.To get "Week 38 of 2023":
"Week " ww" of "yyyyThewwcode represents the week number.
Custom formatting is incredibly powerful for matching specific brand guidelines or reporting standards without complicating your underlying data.
Method 3: Advanced Formatting with Calculated Fields
Sometimes you need more than just a different display format. You might need to restructure the date itself to use in other calculations or text labels. Calculated fields are the ultimate tool for this level of customization. Let's look at three essential date functions.
1. DATENAME() - Get the Name of a Date Part
The DATENAME() function returns the name of a specific part of your date as a string. It’s perfect when you need to pull out just the full month name or the weekday.
Syntax: DATENAME('date_part', [Date Field])
Example: Let's say you want to create a calculated field that returns the full month name.
DATENAME('month', [Order Date])
This formula would return "September" for any date in September.
2. DATEPART() - Get a Number from a Date Part
The DATEPART() function is similar, but it returns the date part as an integer instead of a string. This is useful for mathematical operations, like filtering for specific days of the week (e.g., when DATEPART('weekday', [Order Date]) is greater than 5).
Syntax: DATEPART('date_part', [Date Field])
Example: To get the quarter as a number (1, 2, 3, or 4).
DATEPART('quarter', [Order Date])
3. Creating Fully Custom Formats by Combining Functions
The true power comes when you combine these functions with other string functions like LEFT(), RIGHT(), and STR() to create a format that's impossible to achieve with any one tool.
Example: Getting "Sep-23" as a format
Imagine you want to create a concise "month-year" format, but Tableau doesn't offer this option naturally. You can build it yourself with a calculated field.
LEFT(DATENAME('month', [Order Date]), 3) + "-" + RIGHT(STR(YEAR([Order Date])), 2)
Let's break this down:
DATENAME('month', [Order Date])gets the full month name (e.g., "September").LEFT(..., 3)takes the first 3 characters, giving "Sep".STR(YEAR([Order Date]))converts the year to text (e.g., "2023").RIGHT(..., 2)takes the last 2 characters, "23".Then, concatenate with a "-".
Final Thoughts
Mastering the art of formatting in Tableau is a giant leap toward creating professional, clear, and user-friendly dashboards. Whether you're quickly adjusting the default formats, creating complex custom codes, or leveraging calculated fields, you now have the tools to present your data exactly how you want it.
As we create rich dashboards to help tell day-to-day data stories, making the most of manual reporting is essential. Instead of wrestling with calculated fields or navigating menus in multiple tools just to get your data to look right, let Graphed help you build interactive dashboards quickly and simply. Transform your data presentation and get live, real-time updated visualizations.