[]
        
(Showing Draft Content)

Time Intelligence Functions

The time intelligence function creates calculations that use built-in knowledge about calendars and dates. You can build meaningful comparisons across comparable periods for sales, inventory, etc. by using time and date ranges in combination with aggregations or calculations.

DATEADD


Description


The DATEADD function returns a date, shifted either forward or backward in time by the specified number of intervals from the dates in the current context.


Syntax

DATEADD(<date>,<number_of_intervals>,<interval>)

Parameters

Parameter

Description

date

A column that contains dates.

number_of_intervals

An integer that specifies the number of intervals to add to or subtract from the dates.

interval

The interval by which to shift the dates. The value for interval can be one of the following: YEAR, QUARTER, MONTH, or DAY.

Return Value


A date value.


Example

DATEADD('Sale'[SaleDate],1,YEAR)

The above example will add 1 year in the SaleDate column.


Remarks

The return value of this function is a scalar value.

DATETIMEADD


Description


The DATETIMEADD function returns a datetime, shifted either forward or backward in time by the specified number of intervals from the datetimes in the current context. It supports all intervals of DATEADD function, in addition to the time interval.


Syntax

DATETIMEADD(<datetime>,<number_of_intervals>,<interval>)

Parameters

Parameter

Description

datetime

A column that contains datetime. It supports both date and date time types.

You can pass dataset fields , parameter, or static value to the parameter containing date.

number_of_intervals

An integer that specifies the number of time intervals to add to or subtract from the datetime.

interval

The interval for datetime offsets. The value for interval can be one of the following: YEAR, QUARTER, MONTH, DAY, HOUR, MINUTE, or SECOND.

Return Value


A datetime value.


Example

DATETIMEADD('Sale'[SaleDate],1,HOUR)

The above example will add 1 hour in the SaleDate column.


Remarks

The return value of this function is a scalar value.