view: int_dbt_prod_riaa_model_certification { sql_table_name: INTELLIGENCE.DBT_PROD.RIAA_CERTIFICATION;; parameter: certification_type { type: string label: "Certification Type" allowed_value: { label: "Album" value: "releaseid" } allowed_value: { label: "Track" value: "isrcid" } } dimension: certification_id { label: "Certification Filter" type: string sql: CASE WHEN {% parameter certification_type %} = 'releaseid' THEN TO_VARCHAR(${TABLE}.UPC) ELSE ${TABLE}.ISRC END ;; } dimension: data_source { type: string label: "Data Source" sql: ${TABLE}.DATA_SOURCE ;; # hidden: yes } dimension: upc { type: string label: "UPC" sql: ${TABLE}.UPC ;; } dimension: releasename { type: string label: "Release Name" sql: ${TABLE}.RELEASENAME ;; } dimension_group: releasedate { type: time label: "Relelase Date" timeframes: [raw, date, week, month, quarter, year] sql: ${TABLE}.RELEASEDATE ;; } dimension: isrcid { type: string sql: ${TABLE}.ISRCID ;; hidden: yes } dimension: isrc { type: string label: "ISRC" sql: ${TABLE}.isrc ;; } dimension: isrcname { type: string label: "Track Name" sql: ${TABLE}.ISRCNAME ;; } dimension: labelid { type: string label: "Label ID" sql: ${TABLE}.LABELID ;; } dimension: activity_period { type: string label: "Activity Period" sql: ${TABLE}.ACTIVITY_PERIOD ;; } dimension: storeid { type: string label: "Store ID" sql: ${TABLE}.STOREID ;; hidden: yes } dimension: storename { type: string label: "Store" sql: ${TABLE}.STORENAME ;; } dimension: transactiontypeid { type: number label: "Transaction Type ID" sql: ${TABLE}.TRANSACTIONTYPEID ;; hidden: yes } dimension: transactiontypedesc { type: string label: "Transaction Type" sql: ${TABLE}.TRANSACTIONTYPEDESC ;; } measure: units { type: sum label: "Units" sql: ${TABLE}.units ;; } # measure: certification_units { # type: sum # label: "Certification Units" # sql: ${TABLE}.certification_units ;; # value_format: "#,##0" # } measure: album_certification_units { type: sum label: "Album Certiifcation Units" sql: ${TABLE}.album_certification_units ;; value_format: "#,##0" hidden: yes } measure: track_certification_units { type: sum label: "Track Certification Units" sql: ${TABLE}.track_certification_units ;; value_format: "#,##0" hidden: yes } measure: certification_units { type: sum sql: CASE WHEN {% parameter certification_type %} = 'releaseid' THEN ${TABLE}.album_certification_units ELSE ${TABLE}.track_certification_units END ;; value_format: "#,##0" } }