view: dim_transactiontype { sql_table_name: facts.prod.DIM_TRANSACTIONTYPE ;; dimension: transaction_type_abbr { sql: ${TABLE}.TRANSACTIONTYPEABBR ;; } dimension: transaction_type_desc { sql: ${TABLE}.TRANSACTIONTYPEDESC ;; } dimension: transaction_type_id { primary_key: yes sql: ${TABLE}.TRANSACTIONTYPEID ;; } measure: number_of_transations { type: count_distinct sql: ${transaction_type_id} ;; } dimension: transaction_mapping { description: "Stream, Dowload, Locker, Physical, Other" view_label: "Transaction Type" label: "Stream Ad-Supp, Stream Prem, Download, Physical, Locker, Other" case: { when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('AS', 'AV', 'NR', 'NS') ;; label: "Stream Ad-Supported" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ( 'MT', 'S', 'SV', 'TL', 'VR', 'TA') ;; label: "Stream Premium" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('CL') ;; label: "Locker" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('DA', 'DR', 'DT', 'DV', 'MV', 'RB', 'RV', 'UA', 'UT', 'UV') ;; label: "Download" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('TD') ;; label: "Tethered Download" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('PS', 'RE') ;; label: "Physical" } else: "Other" } } dimension: stream_vs_download { description: "Stream includes all streaming transaction types, i.e. CL, Download includes all download transaction types, i.e. DR" view_label: "Transaction Type" label: "Stream vs Download vs Physical vs Perf Rights vs Bonus" case: { when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('AV', 'SE', 'VU', 'AS', 'NS', 'TR', 'VS', 'TL', 'SV', 'CV', 'CR', 'CA', 'US', 'MT', 'MV', 'CAV', 'AEA', 'CL', 'NR', 'AEV', 'TA', 'S') ;; label: "Stream" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('RV', 'DV', 'CE', 'UT', 'VB', 'UA', 'RB', 'DR', 'RD', 'DT', 'PR', 'NT', 'ED', 'UV', 'VR', 'TH', 'AL', 'PH', 'DA', 'FT', 'TD') ;; label: "Download" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR = 'RC' ;; label: "Perf Rights" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR = 'SR' ;; label: "Sync Revenue" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('PS','RE') ;; label: "Physical" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('SB') ;; label: "Streaming Bonus" } when: { sql: ${TABLE}.TRANSACTIONTYPEABBR in ('DB') ;; label: "Download Bonus" } else: "Other" } } }