4.8/5
Home

Integrations

Plug Count neatly into your existing data infrastructure

For data teams

Collaborative, AI-driven data exploration and modelling

For product & growth

Faster access to the answers which matter

For leaders

Turning data into an engine of improvement

Pricing

Latest post

Meet the new Count Agent

Meet the new Count Agent

Docs

Guides, references, and API docs

Blog

Opinions, analysis, and the occasional uncomfortable truth about data.

Webinars

Join our experts for deep dives into data analytics and business intelligence

Gallery

Browse ready-to-use canvas templates and try them instantly

Sign in

Where to begin?

Start for free

Spin up a canvas and explore your data — a couple of clicks, no card.

Book a demo

See it live. Bring your questions — we’ll bring the answers.

Still not sure?

Send us a note — we’ll point you the right way.

Data to decisions, faster.

Compare

  • Count vs BI
  • Count vs Notebooks
  • Count vs Chatbots
  • Count vs Hex
  • Count vs Looker
  • Count vs Tableau
  • Count vs Thoughtspot

Learn

  • Blog
  • Webinars
  • SQL tutorials

Legal & security

  • Privacy Policy
  • Terms of Use
  • Cookies Policy
  • Trust Center
  • Security

Social

  • LinkedIn →
  • YouTube →
  • X →

Start with the hard question.

Ask Count anything — we’ll take you straight into a canvas.

Opens sign-up with your prompt ready for Count.

© 2026 Count Technologies Ltd. All rights reserved.

Careers →Book a Demo →
count

SQL Resources

Count is the best SQL IDE, wrapped up in the best data analysis tool, all inside the best BI platform.

ARRAY_AGG
Arrays Explained
Arrays Explained
CASE
CAST
COALESCE
CONCAT
COUNT [DISTINCT]
CURRENT_DATE
CURRENT_DATETIME
CURRENT_TIMESTAMP
DATETIME_DIFF
DATETIME_TRUNC
DATE_DIFF
DATE_TRUNC
DefinitionPractical InfoCommon QuestionsTroubleshooting Common ErrorsRelated Pages
Data Types
Dates and Times
EXTRACT
IF
MEDIAN
SUBSTR
String Functions Explained
TIMESTAMP_DIFF
TIMESTAMP_TRUNC
TIME_DIFF
TIME_TRUNC
UNNEST
Window Functions Explained
SQL Resources/BigQuery Standard SQL/DATE_TRUNC

DATE_TRUNC

DATE_TRUNC function. Definition, syntax, examples and common errors using BigQuery Standard SQL. The DATE_TRUNC function in BigQuery will truncate the date to the given date_part.

ℹ️

See also DATETIME_TRUNC, TIMESTAMP_TRUNC, TIME_TRUNC

Definition

The DATE_TRUNC function in BigQuery will truncate the date to the given date_part.

Where date_part can be any of the following:

DATE_TRUNC(date_expression, date_part)
  • WEEK(): Truncates date_expression to the preceding week boundary, where weeks begin on WEEKDAY. Valid values for WEEKDAY are SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY.
  • ISOWEEK: Truncates date_expression to the preceding ISO 8601 week boundary. ISOWEEKs begin on Monday. The first ISOWEEK of each ISO year contains the first Thursday of the corresponding Gregorian calendar year. Any date_expression earlier than this will truncate to the preceding Monday.
  • ISOYEAR: Truncates date_expression to the preceding ISO 8601 week-numbering year boundary. The ISO year boundary is the Monday of the first week whose Thursday belongs to the corresponding Gregorian calendar year.

Returns: DATE

monthweekyear
2021-01-012020-12-272021-01-01

Practical Info

  • Always returns a DATE, so even if you are truncating to the YEAR, you'll received back the first day of that year. For that reason, it's often use in conjunction with FORMAT_DATE if you want to just use the year YYYY.
  • Be careful when dealing with multiple TRUNCs - as seen in the example above, a date in 2021 can be counted in 2020 if the first day of the week was there. So if you counted by YEAR vs YEAR(WEEK) you would get different results.

Common Questions

How do I aggregate my data by month?

DATE_TRUNC is very handy for aggregating your data by a particular date_part, like MONTH. See the example below to see how you can aggregate by MONTH:

SELECT
  DATE_TRUNC(CAST('2021-01-01' AS DATE), MONTH) AS month,
  DATE_TRUNC(CAST('2021-01-01' AS DATE), WEEK) AS week,
  DATE_TRUNC(CAST('2021-01-01' AS DATE), YEAR) AS year
totalmonth
102021-02-01
272021-01-01

Make sure you've included your DATE_TRUNC column in your GROUP BY!

Troubleshooting Common Errors

Argument 1 of DATE_TRUNC has incorrect type: expected date found timestamp.

SELECT
  SUM(number) AS total,
  DATE_TRUNC(date, MONTH) AS month
FROM
  (
    SELECT
      CAST('2021-02-04' AS DATE) AS date,
      3 AS number
    UNION ALL
(    SELECT
      CAST('2021-02-14' AS DATE) AS date,
      7 AS number)
    UNION ALL
(    SELECT
      CAST('2021-01-04' AS DATE) AS date,
      27 AS number)
  ) AS table_3
GROUP BY
  month

You'll need to make sure you're using the right function for your data type. To use DATE_TRUNC, you must be working with a DATE, and not a DATETIME, TIMESTAMP, or TIME.

You can use CAST to change your other date types to DATE, or use one of the equivalent functions for other date types like DATETIME_TRUNC.

Related Pages

  • DATETIME_TRUNC
  • Dates and Times in Standard SQL

Got a CSV?
See it differently in <2 mins

Get started for FREEWatch our CEO do it