fiscal period was blank cause rows not to net to -0- with merge, iteration name incorrect for baseline
This commit is contained in:
parent
b4e2ca7919
commit
8de3ee5717
@ -9,7 +9,7 @@ CREATE TEMP TABLE tdr AS (
|
|||||||
DATERANGE('2020-05-01','2021-05-01','[)') drange
|
DATERANGE('2020-05-01','2021-05-01','[)') drange
|
||||||
,DATERANGE(('2020-05-01'::date + '1 year'::interval)::date,('2021-05-01'::date + '1 year'::interval)::date,'[)') repl
|
,DATERANGE(('2020-05-01'::date + '1 year'::interval)::date,('2021-05-01'::date + '1 year'::interval)::date,'[)') repl
|
||||||
,'1 year'::interval AS incr
|
,'1 year'::interval AS incr
|
||||||
,(SELECT jsonb_agg(x.v) FROM (VALUES('copy'),('actuals'),('actuals plug')) AS x(v)) iter
|
,(SELECT jsonb_agg(x.v) FROM (VALUES('copy'),('actuals'),('actuals_plug')) AS x(v)) iter
|
||||||
);
|
);
|
||||||
|
|
||||||
WITH
|
WITH
|
||||||
@ -56,7 +56,8 @@ gld AS (
|
|||||||
,greatest(least(o.sdate,gld.edat),gld.sdat) dhidat
|
,greatest(least(o.sdate,gld.edat),gld.sdat) dhidat
|
||||||
,null::text fesind
|
,null::text fesind
|
||||||
,null::text dhpost
|
,null::text dhpost
|
||||||
,o.fspr
|
---for forecasting purposes there are no open orders, populate fspr----
|
||||||
|
,ss.fspr
|
||||||
-----------measures--------------------
|
-----------measures--------------------
|
||||||
,null::numeric ddqtoi
|
,null::numeric ddqtoi
|
||||||
,null::numeric ddqtsi
|
,null::numeric ddqtsi
|
||||||
@ -169,7 +170,7 @@ gld AS (
|
|||||||
---exclude integrated quotes----
|
---exclude integrated quotes----
|
||||||
AND version = 'ACTUALS'
|
AND version = 'ACTUALS'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
o.fspr
|
ss.fspr
|
||||||
,o.plnt
|
,o.plnt
|
||||||
,COALESCE(o.promo,'')
|
,COALESCE(o.promo,'')
|
||||||
,o.terms
|
,o.terms
|
||||||
@ -581,9 +582,7 @@ SELECT * FROM baseline
|
|||||||
o.odate <@ (SELECT tdr.drange FROM tdr)
|
o.odate <@ (SELECT tdr.drange FROM tdr)
|
||||||
OR o.odate <@ (SELECT tdr.repl FROM tdr)
|
OR o.odate <@ (SELECT tdr.repl FROM tdr)
|
||||||
GROUP BY
|
GROUP BY
|
||||||
o.odate
|
o.dhidat
|
||||||
,o.rdate
|
|
||||||
,o.dhidat
|
|
||||||
,o.fspr
|
,o.fspr
|
||||||
,o.plnt
|
,o.plnt
|
||||||
,o.promo
|
,o.promo
|
||||||
|
Loading…
Reference in New Issue
Block a user