diff --git a/models/intermediate/cross/int_daily_currency_exchange_rates.sql b/models/intermediate/cross/int_daily_currency_exchange_rates.sql index bb5eb88..590b3e6 100644 --- a/models/intermediate/cross/int_daily_currency_exchange_rates.sql +++ b/models/intermediate/cross/int_daily_currency_exchange_rates.sql @@ -64,7 +64,7 @@ with ), -- CTEs for projecting backward oldest_xe_date_per_curr_pair as ( - select from_currency, to_currency, max(rate_date_utc) as oldest_date_utc + select from_currency, to_currency, min(rate_date_utc) as oldest_date_utc from stg_xedotcom__exchange_rates group by 1, 2 ), @@ -84,10 +84,9 @@ with ( {{ var("start_date") }}::timestamp, ( - select max(most_recent_date_utc) - from most_recent_xe_date_per_curr_pair + select min(oldest_date_utc) from oldest_xe_date_per_curr_pair )::timestamp - - interval '2 days', -- we don't want to pick the last real day, + - interval '1 days', -- we don't want to pick the last real day, '1 day'::interval ) day_series ),