A Date with Dates

Mastering Date Functions in Tableau: A Guide for Data Storytellers

When it comes to data analysis, time is often the most powerful dimension. Whether you’re tracking sales over months, customer growth by quarter, or retention over years, understanding how to work with dates is essential.

Tableau gives us a rich set of date functions that let us manipulate, calculate, and display time exactly the way we need. In this post, we’ll explore the most useful date functions in Tableau and how to apply them in real-world scenarios.


1. TODAY() – Work with the Current Date

Need to compare everything against today’s date? Tableau’s TODAY() function returns the current system date.

Example:

DATEDIFF('day', [Order Date], TODAY())

This calculates how many days have passed since an order was placed. Perfect for age-of-order or SLA tracking.


2. NOW() – Current Date and Time

Unlike TODAY(), which only gives you the date, NOW() provides both date and time.

Example:

NOW()

Useful if you’re working with timestamps (e.g., call centre data, IoT logs).


3. DATEPART() – Extract a Specific Part of a Date

DATEPART() pulls out a portion of a date, like year, month, or weekday.

Example:

DATEPART('month', [Order Date])

Returns the numeric month (1–12) of each order.

Handy for creating custom groupings or bucketing by date.


4. DATENAME() – Get the Name Instead of the Number

If you want the actual name (like “January” instead of 1), use DATENAME().

Example:

DATENAME('weekday', [Order Date])

This returns “Monday,” “Tuesday,” etc. Great for readable labels on charts.


5. DATEADD() – Shift Dates Forward or Backward

DATEADD() lets you add or subtract time periods from a date.

Example:

DATEADD('month', 3, [Order Date])

Moves the order date three months forward.

Useful for forecasting, trailing periods, or comparing rolling windows.


6. DATEDIFF() – Find the Gap Between Two Dates

This calculates the difference between two dates in terms of years, months, days, hours, etc.

Example:

DATEDIFF('year', [Customer Since], TODAY())

Returns how many years each customer has been with you.


7. MAKEDATE() and MAKEDATETIME() – Build Dates from Components

Sometimes you only have parts of a date (like year, month, day in separate fields). MAKEDATE() lets you stitch them together.

Example:

MAKEDATE([Year], [Month], [Day])

Creates a proper date field from separate columns.

For timestamps, use MAKEDATETIME().


8. DATEPARSE() – Convert Text to Dates

Ever had a messy dataset where dates are stored as text (e.g., "2025-08-29") instead of true dates? DATEPARSE() comes to the rescue.

Example:

DATEPARSE("yyyy-MM-dd", [Text Date])

Converts "2025-08-29" into a usable date field in Tableau.


9. DATETRUNC() – Snap Dates to a Level of Detail

DATETRUNC() trims a date to the start of a given period (year, month, quarter, etc.).

Example:

DATETRUNC('month', [Order Date])

Turns any date in August 2025 into 2025-08-01. Perfect for clean month-level aggregations.


10. Combining Date Functions – Real Example

Here’s a scenario: You want to know how many orders were placed in the last 90 days.

IF [Order Date] >= DATEADD('day', -90, TODAY())
THEN "Last 90 Days"
ELSE "Older"
END

This calculation creates a dynamic grouping to segment recent vs. older orders.


Final Thoughts

Time is one of the trickiest dimensions in data analysis, but Tableau’s date functions make it much easier. Here’s a quick recap:

  • Use TODAY() and NOW() for dynamic, current-date comparisons.
  • Use DATEPART() and DATENAME() to break dates into useful components.
  • Use DATEADD() and DATEDIFF() for moving through time and calculating gaps.
  • Use DATETRUNC() to snap dates neatly into levels (month, quarter, year).
  • Use DATEPARSE() and MAKEDATE() to clean and build proper date fields.

By mastering these, you’ll be able to slice and dice your data over time, create insightful trend analyses, and tell compelling time-based stories.

Author:
Younes Ghouini
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2025 The Information Lab