How to Use DATEADD in Tableau

Cody Schneider••8 min read

Working with dates in Tableau can feel like a puzzle, but the DATEADD function is one of the most powerful pieces for putting it all together. It lets you easily add or subtract time from your dates, opening up a whole new level of analysis. This guide will walk you through exactly what DATEADD is and how you can use it to calculate future deadlines, compare time periods, and make your reports more dynamic.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What is the DATEADD Function in Tableau?

The DATEADD function allows you to add a specific interval of time - like a number of days, months, or years - to a date you provide. The result is a new date. Think of it as a time machine for your data, letting you jump forward or backward in time from any date field you have.

Whether you're calculating a 30-day trial expiration date, setting a future follow-up reminder, or comparing this month's sales to last month's, DATEADD is the function you'll need.

Understanding the DATEADD Syntax

The formula for DATEADD is straightforward and consistent. It requires three pieces of information, called "arguments":

DATEADD('date_part', interval, date)

Let's break down what each part means:

  • 'date_part': This tells Tableau the unit of time you want to add. It must be a constant string in single quotes. Common options include 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', and 'second'. This part is not case-sensitive, so 'day' and 'DAY' both work.
  • interval: This is the number of units you want to add or subtract. It's a whole number (an integer). If you want to go back in time, you simply use a negative number. For example, an interval of -14 would subtract 14 units.
  • date: This is the starting date you're modifying. It's usually a date field from your data source, like [Order Date], or another date function like TODAY().

For example, if you wanted to find the date 90 days after an order was placed, your formula would look like this:

DATEADD('day', 90, [Order Date])

This expression reads: "Take the [Order Date], and add 90 days to it." The result will be a new date field.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

How to Create a DATEADD Calculated Field

Putting the DATEADD function to work involves creating a calculated field. It’s a simple process that gives you a brand new, reusable field in your data pane.

Here’s how to do it step-by-step:

  1. Open or Create a Calculated Field: In your Tableau worksheet, right-click in the Data pane on the left and select "Create Calculated Field." Alternatively, you can go to the "Analysis" menu at the top and choose "Create Calculated Field."
  2. Name Your New Field: A dialog box will appear. Give your calculated field a descriptive name. For this example, let's call it "Warranty Expiration Date."
  3. Enter the DATEADD Formula: In the formula box, type your DATEADD expression. Imagine we have a [Purchase Date] field, and our product warranty lasts for one year. The formula would be:
DATEADD('year', 1, [Purchase Date])

Tableau will show a message "The calculation is valid." at the bottom if the syntax is correct.

  1. Save the Field: Click "OK." Your new calculated field, "Warranty Expiration Date," will now appear in the Data pane under your Tables. It will have a small calendar icon next to it, indicating it's a date field.
  2. Use your New Field: Now you can drag and drop "Warranty Expiration Date" into your visualization just like any other field. For instance, you could drag "Purchase Date" and "Warranty Expiration Date" to the Rows shelf to see a simple table comparing the two dates for each transaction.

Practical Examples of Using DATEADD

The real power of DATEADD comes from its flexibility in solving common business problems. Here are some relatable scenarios where this function is a lifesaver.

Example 1: Calculating Future Subscription Renewals

Let's say you manage a subscription service. Customers can sign up for monthly or yearly plans, and you need to forecast upcoming renewal revenue. DATEADD makes it simple to find each customer's next renewal date.

  • Goal: Find the renewal date for an annual subscription.
  • Starting Field: [Subscription Start Date]
  • Calculated Field Name: Renewal Date
  • Formula:
DATEADD('year', 1, [Subscription Start Date])

To calculate a monthly renewal, you would just change the date part and interval:

DATEADD('month', 1, [Subscription Start Date])

You can then build a report showing how many renewals are scheduled for each month, helping your finance and customer success teams plan ahead.

Example 2: Shifting Time Periods for Year-over-Year Comparison

Comparing this year's performance to last year's is a fundamental reporting task. DATEADD is essential for aligning the two time periods on the same axis for an apples-to-apples comparison.

  • Goal: Compare this year's monthly sales vs. last year's monthly sales on one line chart.
  • Challenge: January 2023 and January 2024 are on different parts of a continuous date axis. We need to "trick" Tableau into plotting last year's data on this year's timeline.

Here’s how to do it:

  1. Isolate This Year's Sales (TYS): Create a calculated field named Sales (This Year).
IF YEAR([Order Date]) = YEAR(TODAY()) THEN [Sales] END
  1. Isolate Last Year's Sales (LYS): Create a calculated field named Sales (Last Year).
IF YEAR([Order Date]) = YEAR(TODAY()) - 1 THEN [Sales] END
  1. Shift Last Year's Dates Forward: Create a calculated field called Adjusted Order Date for YoY.
DATEADD('year', 1, [Order Date])

To build the view, drag Adjusted Order Date for YoY to the Columns shelf and set it to display MONTH. Then, drag Sales (This Year) and Sales (Last Year) to the Rows shelf. Now, sales from January of last year will line up perfectly with sales from January of this year because you've artificially shifted all of last year's dates into the current year.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Example 3: Setting Past Project Milestones

DATEADD isn't just for looking forward, it's also perfect for calculating dates in the past. To do this, you simply use a negative number for your interval.

  • Goal: Determine the 'Project Kickoff Date', which is always 45 days before the completion date.
  • Starting Field: [Project Completion Date]
  • Calculated Field Name: Project Kickoff Date
  • Formula:
DATEADD('day', -45, [Project Completion Date])

The interval of -45 tells Tableau to subtract 45 days, giving you the start date for each project.

Common Mistakes and Pro Tips

As you get more comfortable with DATEADD, here are a few things to watch out for and some tips to take your calculations to the next level.

Tip 1: Double-Check Your date_part Syntax

A common error is forgetting the single quotes around the 'date_part'. Writing 'day' is correct, but day or "day" will cause an error. Remember, Tableau needs it as a plain-text string.

Tip 2: Use Negative Numbers for Subtraction

New users sometimes look for a "DATESUBTRACT" function. There isn't one. Subtraction is handled within DATEADD by using a negative integer for the interval. To go back one month, you use DATEADD('month', -1, [Your Date]).

Tip 3: Make it Interactive with Parameters

Instead of hard-coding the interval, you can use a parameter to let end-users control the time shift.

  1. Create a new parameter. Let's name it "Number of Months." Set the data type to "Integer" and allow "All" values.
  2. Right-click the parameter and select "Show Parameter."
  3. In your calculated field, replace the hard-coded number with the parameter:
DATEADD('month', [Number of Months], [Order Date])

Now, users can type a number into the parameter control box, and the dates in your visualization will update automatically. This is fantastic for building flexible forecasting or what-if analysis tools.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Tip 4: Combine DATEADD with Other Functions

DATEADD becomes even more useful when you pair it with other date functions. For example, what if you need to find the last day of the previous month?

First, use DATETRUNC('month', [Order Date]) to find the first day of the current month. Then, subtract one day from that result:

// Result is the last day of the previous calendar month.
DATEADD('day', -1, DATETRUNC('month', [Order Date]))

This kind of stacked logic allows you to answer very specific and complex business questions entirely within Tableau.

Final Thoughts

Mastering the DATEADD function is a major step toward becoming proficient with Tableau. It’s the key to unlocking all sorts of time-based analysis, from calculating simple deadlines and warranty expirations to building complex year-over-year comparisons. By understanding its syntax and common uses, you can transform static date fields into dynamic insights that help your team make smarter, more timely decisions.

While skills like this are invaluable, we built Graphed because we know that even with the right functions, manually building dashboards can still be a huge time sink. We’ve automated the entire process by connecting directly to your marketing and sales data sources - like Google Analytics, Salesforce, and Shopify - and letting you build reports simply by describing what you want in plain English. Instead of writing formulas, you can ask, "Show me a line chart of sales this year compared to last year," and our AI data analyst builds the real-time, interactive dashboard for you in seconds.

Related Articles