diff --git a/readme.md b/readme.md index 963a7c7..dbd8559 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ the basic assumption is a single sales table is available to work with that has the goal then is to break that back apart to whatever degree is necessary. * _**run**_ `schema.sql` and `perd.sql` to setup basic tables -* create a table fc.live as copied from target +* create a table fc.live as copied from target (will need to have columns `version` and `iter` added if not existing) * _**run**_ `target_info.sql` to populate the `fc.target_meta` table that holds all the columns and their roles * fill in flags on table `fc.target_meta` to show how the data is related * _**run**_ `build_master_tables.sql` to generate foreign key based master data @@ -16,3 +16,4 @@ baseline ---------------------------------------------------------------------------------------------------------------------------------------------------- * copy history and increment by year to form a baseline * need to be able to handle order/ship dates generically + * need to build the baseline sql diff --git a/sql/baseline.sql b/sql/baseline.sql index 1d06673..678771b 100644 --- a/sql/baseline.sql +++ b/sql/baseline.sql @@ -3,6 +3,7 @@ WITH baseline AS ( -----------------------copy YTD sales--------------------------------------------------------------------- SELECT + [nonversion] ,'baseline' "version" ,'actuals' iter FROM @@ -26,6 +27,7 @@ baseline AS ( UNION ALL ---------option 1: fill in the rest of the year, with the prior years sales-sales---------------------------- SELECT + [nonversion] ,'baseline' "version" ,'plug' iter FROM @@ -40,6 +42,7 @@ baseline AS ( UNION ALL --------option 2: fill in the remainder of the current year with current forecase----------------------------- SELECT + [nonversion] ,'baseline' "version" ,'plug' iter FROM @@ -54,7 +57,8 @@ baseline AS ( ) -------------------copy the baseline just generated and increment all the dates by one year------------------------------------ ,incr AS ( -SELECT +SELECT + [nondate_columns] ,o.dcodat + interval '1 year' --incremented ,o.ddqdat + interval '1 year' --incremented ,o.dhidat + interval '1 year' --incremented