LASTXMONTHS

Get the date interval for the last X months.

Parameter List

Syntax
LASTXMONTHS(months
[include_current]
)
months

The number of months prior to the current one.

[optional] include_current

Determines whether the current month should be included in the returned date range. If FALSE (default), only fully completed months are counted. If TRUE, the current (possibly partial) month is included. In both cases, the total length is exactly N months.

Examples

LASTXMONTHS(1, FALSE) returns [2021-04-01;2021-04-30]