From 7de60f37ceb54b2bc8d9014570e217f26fbb91ad Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Mon, 12 Jul 2021 15:54:10 -0400 Subject: [PATCH] include plan all the way back from 2021 --- build/build_rolling.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/build_rolling.sql b/build/build_rolling.sql index 731fff5..c115a09 100644 --- a/build/build_rolling.sql +++ b/build/build_rolling.sql @@ -18,7 +18,7 @@ CREATE TEMP TABLE tdr AS ( -----------actuals into baseline------------------------------------- DATERANGE('2020-06-01','2021-07-07','[]') arange -----------plan into baseline---------------------------------------- - ,DATERANGE('2021-06-01','2022-06-01','[)') prange + ,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-------------------------- @@ -183,6 +183,7 @@ gld AS ( ( --base period orders booked.... o.odate <@ (SELECT prange FROM tdr) + OR o.sdate <@ (SELECT prange FROM tdr) --...or any open orders currently booked before cutoff.... --OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate <= (SELECT UPPER(prange) FROM tdr)) --...or anything that shipped in that period