view: orch_app_ar_mkt_priority { # sql_table_name: orchard_app_reporting_v2.art_relations_prod_art_relations.mkt_priority ;; sql_table_name: facts.prod.mkt_priority_all ;; # dimension: mkt_priority_id { # type: number # sql: ${TABLE}.id ;; # primary_key: yes # hidden: yes # } dimension: release_id { type: number sql: ${TABLE}.release_id ;; hidden: yes } dimension: country_id { type: number sql: ${TABLE}.country_id ;; hidden: yes } dimension: priority { label: "Release Priority (A / B)" case: { when: {sql: ${TABLE}.priority = 'a' ;; label: "A" } when: {sql: ${TABLE}.priority = 'b' ;; label: "B" } } } dimension: priority2 { label: "Release Priority" sql: ${TABLE}.priority;; type: string } dimension: is_priority { label: "Release Is Priority" type: yesno sql: IFF(${TABLE}.priority IS NULL, FALSE, TRUE) ;; } measure: count_priority { label: "Number of Priorities" type: count_distinct # sql: ${mkt_priority_id} ;; sql: concat(${TABLE}.release_id,${TABLE}.country_id,${TABLE}.priority) ;; } measure: list_country { label: "List Countries" hidden: yes type: string sql: LISTAGG(DISTINCT ${market_country.country_region_name}, ', ') WITHIN GROUP (ORDER BY ${market_country.country_region_name}) ;; } measure: ca_priority_for_us_pitch{ label: "CA Priority For US Pitch" hidden: yes type: yesno sql: IFF(contains(${list_country},'Canada') AND NOT(contains(${list_country},'USA')),TRUE,FALSE) ;; } }