From b2147b0a02ab155196256647ecf82431a7c0053b Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 30 Jul 2021 08:15:48 -0400 Subject: [PATCH] increment snapshot period --- build/build_pullforward.sql | 2 +- build/build_rolling.sql | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/build_pullforward.sql b/build/build_pullforward.sql index 65a57dc..db9a5a2 100644 --- a/build/build_pullforward.sql +++ b/build/build_pullforward.sql @@ -21,7 +21,7 @@ tdr AS ( DATERANGE('2021-06-01','2022-06-01','[)') prange -----------explicitly call out overlap period------------------------ -----------anythign in this period has to net out to match actuals--- - ,DATERANGE('2021-06-01','2021-07-12','[]') overlap + ,DATERANGE('2021-06-01','2021-07-29','[]') overlap ,jsonb_build_array('plan','diff') iter ) ,booked AS materialized( diff --git a/build/build_rolling.sql b/build/build_rolling.sql index 39e092c..f19e20f 100644 --- a/build/build_rolling.sql +++ b/build/build_rolling.sql @@ -16,19 +16,19 @@ DROP TABLE IF EXISTS tdr; CREATE TEMP TABLE tdr AS ( SELECT -----------actuals into baseline------------------------------------- - DATERANGE('2020-06-01','2021-07-15','[]') arange + DATERANGE('2020-06-01','2021-07-29','[]') arange -----------plan into baseline---------------------------------------- ,DATERANGE('2020-06-01','2022-06-01','[)') prange -----------forecast into baseline------------------------------------ ,DATERANGE('2022-06-01','2022-06-01','[)') frange -- this range effectively excludes -----------baseline selection for increment-------------------------- - ,DATERANGE('2021-07-15','2021-07-15','[)') selection + ,DATERANGE('2021-07-29','2021-07-29','[)') selection -----------selection increment size---------------------------------- ,'0 year'::interval AS incr -----------iterations to merge with---------------------------------- ,(SELECT jsonb_agg(x.v) FROM (VALUES('copy'),('actuals'),('actuals_plug')) AS x(v)) iter -----------existing baseline overlap--------------------------------- - ,DATERANGE('2000-06-01','2021-07-08') overlap + ,DATERANGE('2000-06-01','2021-07-29') overlap ); --select * from tdr