/* This macro provides a boolean answer to the question: - Is this date before the previous month? The computation is based on the current date by using now() Inputs: - date: the date from which you want to check Output: - boolean; true for is before the previous month false for is not before the previous month */ {% macro is_date_before_previous_month(date) %} ( date_trunc('month', ({{ date }})::date)::date + interval '1 month' )::date < date_trunc('month', now())::date {% endmacro %}