How to Add Date in Tableau
Working with dates in Tableau can feel a little tricky at first, but it's one of the most powerful features for analyzing trends over time. Once you get the hang of a few key concepts, you'll be able to quickly drill down from year-over-year performance to daily insights. This guide will walk you through everything from the fundamentals of how Tableau handles dates to creating custom calculations and filters.
Understanding Dates in Tableau: Blue vs. Green Pills
Before you even drag your first date field into a view, it's important to understand the two ways Tableau thinks about dates: Discrete and Continuous.
You can tell them apart by color. When you drag a date onto a view, the pill will be either blue or green. This isn't just for looks, it fundamentally changes how your chart is displayed.
Discrete Dates (Blue Pills)
Think of discrete dates as individual, distinct categories. When you use a discrete date part like "MONTH(Order Date)," Tableau groups all the data for each month together, regardless of the year. So, all January sales from 2022, 2023, and 2024 would be combined into a single bar labeled "January."
- What they do: Create labels or headers for your columns and rows.
- How they look: They create a finite number of buckets. For months, you get 12 buckets (January, February, etc.). For quarters, you get 4 buckets.
- Common use: Comparing performance for the same period across different years, like comparing Q1 sales for every year in your dataset.
Continuous Dates (Green Pills)
Think of continuous dates as points on an unbroken timeline. When you use a continuous date like "MONTH(Order Date)," Tableau plots each point along an axis from the earliest to the latest date. This shows a progression over time, for example: "January 2023," "February 2023," "March 2023," and so on.
- What they do: Create an axis in your view for a trendline.
- How they look: They treat dates as an infinite range. Your timeline could be drilled down infinitely from years to quarters to seconds.
- Common use: Analyzing trends over a specific period, such as sales growth from the beginning of last year to the end of this quarter. This is what you'll use for most line charts.
You can easily switch between them by right-clicking the date pill in your Rows or Columns shelf and selecting either a "Discrete" or "Continuous" option from the context menu.
For now, just remember: Blue means categories, green means an axis.
Free PDF Guide
AI for Data Analysis Crash Course
Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.
Adding and Customizing a Date Field in Your View
Let's start with the basics: adding a date to your visualization. For this example, let's assume you have a dataset with a field called [Order Date] and another called [Sales].
Step-by-Step Instructions
- Find your date field (in this case, [Order Date]) in the Data pane on the left. You'll notice it has a small calendar icon, indicating Tableau correctly recognizes it as a date.
- Drag the [Order Date] field and drop it onto the Columns shelf.
- By default, Tableau usually aggregates the date to the highest level of detail, which is YEAR. You'll see a blue pill that says "YEAR(Order Date)."
- Now, drag your measure, [Sales], and drop it onto the Rows shelf.
You now have a simple bar chart showing total sales for each year in your dataset. But year-level data often isn't granular enough. What if you want to see sales by quarter or month?
Changing Date Granularity
Tableau's date hierarchy makes it incredibly easy to drill down or up through different levels of time. You can change this in a few ways.
Method 1: Click the "+" icon
Notice the small "+" symbol on the "YEAR(Order Date)" pill. Clicking this will drill down to the next level in the hierarchy, adding a "QUARTER(Order Date)" pill next to it. Click the "+" on the quarter pill, and you'll get months. Clicking the "-" collapses it back up.
Method 2: Right-Click the Date Pill
For more control, right-click the date pill in your Columns or Rows shelf. This opens a menu with all the date options. It's split into two sections, which should now look familiar: discrete date parts (at the top, with years and quarters) and continuous date parts (at the bottom, with years and quarters).
- To see sales broken down by month across all years (e.g., to see if January is always a slow month), select the discrete "Month" option from the top section.
- To see a continuous trend of sales over time (e.g., Jan 2023, Feb 2023, ...), select the continuous "Month" option from the bottom section.
Creating Basic Date Calculations
Manually dragging pills is great, but eventually, you'll need to create calculations to answer more specific business questions. Calculated Fields in Tableau let you manipulate your data, and dates are no exception.
To create a calculated field, click the small down arrow at the top of the Data pane and select "Create Calculated Field."
1. Extracting Parts of a Date: DATEPART() and DATENAME()
Sometimes you need to isolate a specific part of a date for a filter or label. You have two primary functions for this:
DATEPART('date_part', [date_field]): Returns the date part as an integer. For example,DATEPART('month', [Order Date])would return 1 for January, 2 for February, and so on.DATENAME('date_part', [date_field]): Returns the date part as a string. For example,DATENAME('month', [Order Date])would return "January", "February", etc.
Example: You want to count how many orders were placed on a Monday. You could create a calculated field called "Day of Week name":
DATENAME('weekday', [Order Date])
2. Calculating Time Differences: DATEDIFF()
This is one of the most useful date functions you'll learn. It calculates the difference between two dates and lets you specify the units (days, weeks, months, etc.).
The syntax is: DATEDIFF('date_part', [start_date], [end_date])
Example: You want to calculate the average time it takes to ship an order. Your data has an [Order Date] and a [Ship Date]. Create a calculated field called "Days to Ship":
DATEDIFF('day', [Order Date], [Ship Date])
You can now drag this new field into your view and use the aggregation "Average" to see the average shipping time.
3. Adding or Subtracting from Dates: DATEADD()
This function lets you add a specified interval to a date.
The syntax is: DATEADD('date_part', interval, [date_field])
Example: Your free trials last 14 days and you want to calculate the trial end date for each user, based on a [Signup Date].
DATEADD('day', 14, [Signup Date])
Using a Relative Date Filter
Often, you don't want to show your entire dataset. You just want a report that always shows the most recent data - like "Last 30 Days" or "This Quarter." Manually updating your filter ranges every day is tedious. A relative date filter does this for you automatically.
- Drag your date field (e.g., [Order Date]) to the Filters card.
- A dialog box will appear. Choose "Relative date" and click Next.
- Now you have several easy-to-use options. You can choose to filter for the last X days/weeks/months, the current period (this week, this year), or the previous period (previous month, previous quarter).
- As an example, to see sales from the last 90 days, you would select "Last", type in "90", and choose "Days" from the dropdown.
This filter is dynamic. When you open the workbook next week, it will automatically filter for the 90 days preceding that day. It's a lifesaver for dashboards that need to stay current.
Free PDF Guide
AI for Data Analysis Crash Course
Learn how to get AI to do data analysis for you — the best tools, prompts, and workflows to go from raw data to insights without writing a single line of code.
Two Quick Tips for Working With Dates
Ensure Your Field is Recognized as a Date
Sometimes, Tableau might import a date field as a string or number. If you don't see the little calendar icon next to your date field in the Data pane, click on the icon that is there (e.g., "Abc" for a string) and change the data type to Date or Date & Time.
Create Custom Date Formats
Don't like how Tableau formats the date on your axis? Right-click the date pill and choose Format. In the Format pane that opens, you can select from a list of default formats or create your own custom one. For example, mmm yyyy would display a date as "Jan 2024".
Final Thoughts
Handling dates in Tableau moves from confusing to intuitive once you grasp the core concepts. Understanding the difference between discrete (blue) and continuous (green) dates unlocks total control over your visualizations, while functions like DATEDIFF and relative filters automate much of the manual work required for building timely, relevant reports.
All of this setup - learning specific formulas, figuring out date granularity, and configuring filters - is precisely what we built Graphed to simplify. We believe getting insights from your data shouldn't require a steep learning curve. Instead of creating calculated fields and clicking through menus, you can connect your data sources in seconds and just ask a question in plain English, like "show me our average days to ship last quarter" or "create a dashboard of our sales trend by month for the last two years." Our AI builds the interactive dashboard for you, live and in real-time, letting you get straight to the answers without ever having to remember the syntax for DATEADD.
Related Articles
Facebook Ads for Dentists: The Complete 2026 Strategy Guide
Learn how to run Facebook ads for dentists in 2026. Discover proven strategies, targeting tips, and ROI benchmarks to attract more patients to your dental practice.
Facebook Ads for Gyms: The Complete 2026 Strategy Guide
Master Facebook advertising for your gym in 2026. Learn the proven 6-section framework, targeting strategies, and ad formats that drive memberships.
Facebook Ads for Home Cleaners: The Complete 2026 Strategy Guide
Learn how to run Facebook ads for home cleaners in 2026. Discover the best ad formats, targeting strategies, and budgeting tips to generate more leads.