update notion of segments when building the forecast pool
This commit is contained in:
parent
c8cb809e18
commit
3fae4d50cc
@ -26,7 +26,8 @@ repc AS (
|
||||
FROM
|
||||
(
|
||||
VALUES
|
||||
('1CU','Retail'),
|
||||
('1CU','Sustainable'),
|
||||
('1SU','Sustainable'),
|
||||
('1GR','Greenhouse'),
|
||||
('1NU','Nursery'),
|
||||
('1RE','Retail'),
|
||||
@ -68,11 +69,43 @@ SELECT
|
||||
,chan
|
||||
,chansub
|
||||
,CASE seg.segm
|
||||
--for 1RE coded product
|
||||
WHEN 'Retail' THEN
|
||||
CASE o.bill_class
|
||||
WHEN 'RMAS' THEN 'MASS'
|
||||
WHEN 'RNAT' THEN 'NATIONAL'
|
||||
ELSE 'OTHER'
|
||||
WHEN 'RONL' THEN 'Online'
|
||||
WHEN 'RNAT' THEN 'National'
|
||||
WHEN 'RMAS' THEN 'National'
|
||||
ELSE
|
||||
------ ship-to class ---------------------
|
||||
CASE o.chan
|
||||
WHEN 'GDIS' THEN 'Distribution'
|
||||
WHEN 'NDIS' THEN 'Distribution'
|
||||
WHEN 'RDIS' THEN 'Distribution'
|
||||
WHEN 'GDRP' THEN 'Grower'
|
||||
WHEN 'NDRP' THEN 'Grower'
|
||||
WHEN 'RDRP' THEN 'Distribution'
|
||||
WHEN 'GDIR' THEN 'Grower'
|
||||
WHEN 'NDIR' THEN 'Grower'
|
||||
-------this will probably need reviewed--------
|
||||
WHEN 'RDIR' THEN 'Distribution'
|
||||
WHEN 'NDIR' THEN 'Grower'
|
||||
WHEN 'GDIR' THEN 'Grower'
|
||||
ELSE 'Distribution'
|
||||
END
|
||||
END
|
||||
--for 1SU 1CU coded product
|
||||
WHEN 'Sustainable' THEN
|
||||
CASE SUBSTRING(o.coltier,1,1)
|
||||
--anything with a bio color tier is bio on the channel
|
||||
WHEN 'R' THEN 'Bio'
|
||||
ELSE
|
||||
CASE o.glec
|
||||
--any 1SU that is not bio is fiber
|
||||
WHEN '1SU' THEN 'Fiber'
|
||||
--any 1CU that is not bio is commercial
|
||||
WHEN '1CU' THEN 'Commercial'
|
||||
ELSE o.chan
|
||||
END
|
||||
END
|
||||
ELSE o.chan
|
||||
END chan_retail
|
||||
|
Loading…
Reference in New Issue
Block a user