Skip to content

DateTrunc

Description

DateTrunc truncates a date to the specified granularity.

Syntax

DateTrunc(date, unit)

Parameters

Parameter Required Type Description
date Yes Date, field, or expression Date to truncate.
unit Yes String Granularity such as "day", "week", "month", "quarter", or "year".

Notes

Use this function in calculated fields, metric expressions, or query expressions where the function category is supported.

Example

DateTrunc(OrderDate, "month")

The expression returns the calculated result according to the current query context.