view: dt_release_country_of_origin_custom { sql_table_name: INTELLIGENCE.DBT_PROD.DT_RELEASE_COUNTRY_OF_ORIGIN_CUSTOM ;; # derived_table: { # sql: select upc, country_of_origin, c.country_code # from ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.RELEASES r # inner join ORCHARD_APP_REPORTING_V2.ART_RELATIONS_PROD_ART_RELATIONS.COUNTRY c on r.country_of_origin = c.id # where country_of_origin != 0 # and distribution_format_id NOT IN (1,57) ;; # } dimension: upc { type: number hidden: yes primary_key: yes sql: ${TABLE}.upc ;; } dimension: country_code { type: string label: "Country of Origin" view_label: "Release" sql: case when ${TABLE}.country_code = 'CS' then 'RS' else ${TABLE}.country_code end;; } }