Source Tables Used In Script
Schema | Table (or Derived Table) Name | Table Type | Purpose |
drp | order_line_revenue | database | Primary |
drp | order_busuiness_unit | database | Lookup |
drp | sku_launch_date | database | Lookup |
drp | calendar | database | Lookup |
drp_staging | sku_combinations | database | Rollup of order_line_revenue and order_business_unit to find unique combinations of sku and store |
drp_staging | sku_sales | database | Rollup sku sales by unique store, sku and order date |
drp_staging | sku_dates | database | Holds sku_performance_date |
drp_staging | sku_performance | database | Pre-insert |
N/A | first_order_date | derived | Obtain the first date an order was made in a store |
N/A | sku_performance_date | derived | Obtain a list of skus for every date from the sku's first order date |
SQL Flow
Calculated and Derived Fields
Target Column | Target Column Data Type | Source schema.table | Source Column | Transformation/Logic |
days_since_launch | INT | drp.sku_launch_date | sku_launch_date | difference in days between sku_launch_date and current date |
product_sales_amount | DECIMAL | drp.order_line_revenue | product_sales_amount | SUM(product_sales_amount) by each unique store, sku and date combination |
paid_units | INT | drp.order_line_revenue | num_feature_items | SUM(num_featured_items) by each unique store, sku and date combination |
total_units | INT | drp.order_line_revenue | num_units | SUM(num_units) by each unique store, sku and date combination |
All content © Daasity 2021. Do not copy, share or distribute.