make sure days are between 1 and 28
This commit is contained in:
parent
06c545dbc6
commit
7008f57f66
@ -174,7 +174,7 @@ target AS (select target_increment incr)
|
||||
_month
|
||||
,seq
|
||||
,promo
|
||||
,round((dom_wa/value_usd)::numeric,0)::int odom
|
||||
,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom
|
||||
,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
||||
,round((slag_wa/value_usd)::numeric,0)::int slag
|
||||
,value_usd/sum(value_usd) over (partition by _month) momix
|
||||
@ -575,4 +575,4 @@ GROUP BY
|
||||
,version
|
||||
,iter
|
||||
)
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
SELECT json_agg(row_to_json(insagg)) x from insagg
|
||||
|
@ -169,7 +169,7 @@ target AS (select target_volume vincr, target_price pincr)
|
||||
_month
|
||||
,seq
|
||||
,promo
|
||||
,round((dom_wa/value_usd)::numeric,0)::int odom
|
||||
,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom
|
||||
,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
||||
,round((slag_wa/value_usd)::numeric,0)::int slag
|
||||
,value_usd/sum(value_usd) over (partition by _month) momix
|
||||
|
@ -247,7 +247,7 @@ target AS (select $$replace_request$$::json def)
|
||||
_month
|
||||
,seq
|
||||
,promo
|
||||
,round((dom_wa/value_usd)::numeric,0)::int odom
|
||||
,greatest(least(round((dom_wa/value_usd)::numeric,0)::int,28),1) odom
|
||||
,round((rlag_wa/value_usd)::numeric,0)::int rlag
|
||||
,round((slag_wa/value_usd)::numeric,0)::int slag
|
||||
,value_usd/sum(value_usd) over (partition by _month) momix
|
||||
|
Loading…
Reference in New Issue
Block a user