view: dt_supply_chain_sale_start_dates { sql_table_name: INTELLIGENCE.DBT_PROD.DT_SUPPLY_CHAIN_SALE_START_DATES ;; # derived_table: { # sql: select r.release_id as product_id, r.sale_start_date as default_sale_start_date, p.sale_start_date as specific_sale_start_date, p.store_id as store_id, # CASE # WHEN specific_sale_start_date is not null then specific_sale_start_date # ELSE default_sale_start_date end as sale_start_date # from ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.RELEASES r # inner join ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.PRODUCT_PHYSICAL pp on pp.release_id = r.release_id # left join ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.PRODUCT_PHYSICAL_SUPPLY_CHAIN_METADATA p on p.product_id = r.release_id # group by 1,2,3,4,5;; # } dimension: product_id { type: number hidden: yes sql: ${TABLE}.product_id ;; } dimension: default_sale_start_date { type: date hidden: yes sql: ${TABLE}.default_sale_start_date ;; } dimension: specific_sale_start_date { type: date hidden: yes sql: ${TABLE}.specific_sale_start_date ;; } dimension: store_id { label: "Store ID" type: number sql: ${TABLE}.store_id ;; } dimension: sale_start_date { type: date label: "Sale Start Date" sql: ${TABLE}.sale_start_date ;; } }