months_since
Months since given date (truncated)
months_since(date)
Parameters
| Name | Type | Description |
|---|---|---|
date |
field | Date field to measure from, e.g. first_trade_date |
Formula
months_since = EXTRACT(YEAR FROM AGE(scan_date, date)) * 12 + EXTRACT(MONTH FROM AGE(scan_date, date))
Examples
// Stocks that started trading within the last 6 months
months_since(first_trade_date) < 6;
// Stocks trading for at least 12 months
months_since(first_trade_date) >= 12;
Returns
int