Type: Function
Function: LAST_N_TIMEPERIOD
Syntax: LAST_N_TIMEPERIOD(date, number, period)
Description: Returns true if the date is within the number of complete periods before the current one.
The period is "HOUR", "DAY", "WEEK", "MONTH", "QUARTER" or "YEAR", in upper or lower case.
The current period is not included: in May, the previous 3 months are February, March and April.
It is the same condition as the Previous filter of the insight designer (see Using filters). Use it in a custom formula, to count, group or label records on that condition, or as a filter in a query sent through the Keypup API or MCP server.
Sample usage:
LAST_N_TIMEPERIOD(created_at, 3, "MONTH")returnstruefor the records created in the three months before this one.LAST_N_TIMEPERIOD(closed_at, 1, "WEEK")returnstruefor the records closed last week.
