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