vupd was scaling from scratch instead of just cleaning up the volume increase to match the dollar target
This commit is contained in:
parent
22841d3671
commit
bf03eff862
@ -358,9 +358,11 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
(SELECT pincr::numeric FROM target) incr
|
(SELECT pincr::numeric FROM target) incr
|
||||||
,(SELECT sum(fb_val_loc * r_rate) FROM volume) base
|
,(SELECT sum(fb_val_loc * r_rate) FROM volume) base
|
||||||
,CASE WHEN (SELECT sum(fb_val_loc * r_rate) FROM volume) = 0 THEN
|
,CASE WHEN (SELECT sum(fb_val_loc * r_rate) FROM volume) = 0 THEN
|
||||||
|
--if the base value is -0- scaling will not work, need to generate price, factor goes to -0-
|
||||||
0
|
0
|
||||||
ELSE
|
ELSE
|
||||||
(SELECT pincr::numeric FROM target)/(SELECT sum(fb_val_loc * r_rate) FROM volume)
|
--if the target $amount is not achieved, adjust further
|
||||||
|
((SELECT pincr::numeric FROM target)-(SELECT sum(fb_val_loc * r_rate) FROM volume))/(SELECT sum(fb_val_loc * r_rate) FROM volume)
|
||||||
END factor
|
END factor
|
||||||
,CASE WHEN (SELECT sum(fb_val_loc * r_rate) FROM volume) = 0 THEN
|
,CASE WHEN (SELECT sum(fb_val_loc * r_rate) FROM volume) = 0 THEN
|
||||||
CASE WHEN ((SELECT pincr::numeric FROM target) - (SELECT sum(fb_val_loc * r_rate) FROM volume)) <> 0 THEN
|
CASE WHEN ((SELECT pincr::numeric FROM target) - (SELECT sum(fb_val_loc * r_rate) FROM volume)) <> 0 THEN
|
||||||
|
Loading…
Reference in New Issue
Block a user