What Does DATE_TRUNC Do in Tableau?

Cody Schneider7 min read

Working with dates is a constant in data analysis, but getting them into the right format for a report or chart can be a headache. If you have daily sales data but want to see a monthly trend, you need a way to group all those individual days together. That's exactly what the DATE_TRUNC function in Tableau is for. This article will show you what DATE_TRUNC does, how to use it, and why it's a go-to function for creating clean, insightful visualizations.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is the DATE_TRUNC Function in Tableau?

The DATE_TRUNC function lets you take a specific date and "truncate" it to the beginning of a specific time period. Think of it like a rounding tool for dates. Instead of rounding a number like 178 down to 100, DATE_TRUNC "rounds" a date like July 26, 2024, down to the beginning of its month, July 1, 2024.

This is incredibly useful because it standardizes your dates. Every single transaction, website visit, or support ticket that happened in July will now share the exact same date value: July 1st. This allows Tableau to easily group, or aggregate, all the data from that month into a single point on your chart.

Here’s a quick look at how it works:

  • If your original date is 2024-10-15 and you truncate it to the quarter, the new date is 2024-10-01.
  • If your original date is 2024-10-15 and you truncate it to the month, the new date is 2024-10-01.
  • If your original date is 2024-10-15 at 10:30 AM and you truncate it to the day, the new date is 2024-10-15 at 12:00 AM.
  • If your original date is 2024-10-15 (a Tuesday) and you truncate it to the week, the new date is 2024-10-13 (the preceding Sunday, by default).

By simplifying dates this way, DATE_TRUNC helps you move from noisy, granular data to clean trends that are easy to understand.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Understanding the DATE_TRUNC Syntax

The formula for DATE_TRUNC is simple and has three parts, one of which is optional.

DATE_TRUNC('date_part', date, ['start_of_week'])

Let’s break down each component:

  • 'date_part': This tells Tableau the level of detail you want to truncate your date to. You'll put this in single quotes. The most common options are:
  • date: This is the date field from your data source that you want to manipulate. In Tableau formulas, you’ll typically write this as [Your Date Field], like [Order Date] or [Signup Date].
  • ['start_of_week'] (Optional): This optional parameter lets you define on which day a new week begins. By default, Tableau starts the week on Sunday. But if your business reporting runs Monday to Sunday, you can specify 'monday'. This ensures your weekly reports align with how your business operates.

Practical Examples: How to Use DATE_TRUNC in Tableau

The best way to understand DATE_TRUNC is to see it in action. Here are a few common scenarios where it makes a huge difference.

Use Case 1: Visualizing Monthly Sales Trends

The problem: You have a dataset with sales data for every single day of the year. When you try to build a line chart to see your sales performance over time, Tableau shows you a chaotic, spiky line with 365 different points. It's hard to spot the underlying trend.

The solution: Use DATE_TRUNC to group your sales by month. This will create a clean line chart with just 12 data points, making the monthly performance trend obvious.

Step-by-Step Instructions:

  1. Connect to your sales data in Tableau.
  2. Open the side pane, click the dropdown arrow at the top, and select "Create Calculated Field...".
  3. Name your new field something clear, like "Order Month".
  4. In the formula box, type the following expression, replacing [Order Date] with your actual date field:
  5. Click OK. You now have a new field in your data pane.
  6. Drag your new "Order Month" field to the Columns shelf.
  7. Drag your "Sales" measure to the Rows shelf.

Instantly, you’ll see a clean line chart summarizing your total sales for each month. Each point on the chart is set to the first day of the month, but it represents the sum of all sales that occurred during that entire month.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Use Case 2: Tracking Week-Over-Week Campaign Performance

The problem: You're a marketing manager analyzing website traffic from a new ad campaign. Your team’s weekly report-outs start on Monday, but Tableau's default week starts on Sunday. This mismatch causes confusion and makes it difficult to compare apples-to-apples weekly performance.

The solution: Use DATE_TRUNC to create a weekly date dimension that aligns with your business's schedule by setting Monday as the start of the week.

Step-by-Step Instructions:

  1. In your Tableau workbook, create a new calculated field.
  2. Name it "Week Start (Monday)".
  3. Enter the following formula, making sure to use your session date field:
  4. Click OK.
  5. Drag your new "Week Start (Monday)" field to the Columns shelf.
  6. Right-click the pill in the Columns shelf and make sure it's set to "Exact Date" and "Discrete" to clearly label each week.
  7. Drag your traffic measure (e.g., Sessions or Users) to the Rows shelf.

Now you have a bar chart or line chart showing week-over-week traffic where every week correctly starts on a Monday. Your reporting is now perfectly aligned with your team's cadences, and no one has to mentally adjust for the Sunday start date.

Use Case 3: Summarizing Financial Data by Quarter

The problem: You need to create a high-level summary of company revenue for a quarterly business review. You have thousands of individual transactions, and you need a quick way to roll them up into financial quarters (Q1, Q2, Q3, Q4).

The solution: Use DATE_TRUNC to aggregate all transaction dates into their respective quarters.

Step-by-Step Instructions:

  1. Create a calculated field and name it "Transaction Quarter".
  2. Use the following formula, adapted to your date field:
  3. Click OK.
  4. Drag "Transaction Quarter" to the Rows or Columns shelf.
  5. Drag your "Revenue" measure to create a text table or bar chart.

This calculated field will convert every date into the first day of its quarter (January 1, April 1, July 1, or October 1). This gives you four distinct data points for the year, showing you the total revenue for each quarter in a clean, simple format ideal for executive summaries.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

A Quick Note: DATE_TRUNC vs. DATEPART & DATENAME

Beginners in Tableau often get confused between DATE_TRUNC, DATEPART, and DATENAME because they all work with dates. However, they serve very different purposes.

Here’s the difference:

  • DATE_TRUNC: Returns a full date value, just pared down to the start of a period. It preserves the full context of the date (including the year). Example: DATE_TRUNC('month', #2024-07-26#) returns 2024-07-01.
  • DATEPART: Extracts and returns a numerical integer representing the part of the date you specified. It loses the rest of the date’s context. Example: DATEPART('month', #2024-07-26#) returns 7.
  • DATENAME: Extracts and returns a string (text) representing the name of the date part you specified. Example: DATENAME('month', #2024-07-26#) returns "July".

Use DATE_TRUNC when you want to create a continuous chronological axis for trend analysis. Use DATEPART or DATENAME when you want to group data across years, like comparing the performance of all "Julys" or all "Mondays" together.

Final Thoughts

The DATE_TRUNC function is a simple but powerful tool for anyone who works with time-series data in Tableau. It gives you control over the level of detail in your charts, helping you transform messy, day-level data into clear, actionable reporting for tracking trends by week, month, quarter, or year.

Instead of wrestling with calculated fields and complex formulas in tools like Tableau, we built a way to get these answers automatically. With Graphed, you simply connect your data sources (like Google Analytics or your sales database) and ask questions in plain English, like "Show me my sales trend by month for this year." Graphed generates a real-time, interactive dashboard for you in seconds, saving you the time and hassle of manual data prep and visualization.

Related Articles