view: int_dbt_prod_spotify_dm_raw_streams { sql_table_name: INTELLIGENCE.dbt_prod_strategy.SPOTIFY_DM_RAW_STREAMS ;; dimension: primary_key { primary_key: yes hidden: yes description: "Primary Key" sql: CONCAT(${TABLE}.isrc, ${TABLE}.artist_name, ${TABLE}.track_name,${TABLE}.label_name, ${TABLE}.genre, ${TABLE}.release_year, ${TABLE}.lift_needed, ${TABLE}.start_date, ${TABLE}.end_date, ${TABLE}.spotify_source, ${TABLE}.activity_date, ${TABLE}.streams, ${TABLE}.discovery_streams, ${TABLE}.unique_listeners) ;; } dimension: ISRC { description: "The ISRC" view_label: "Track" type: string sql: ${TABLE}.isrc ;; } dimension: label_name { description: "Label name associated with the ISRC" view_label: "Label" type: string sql: ${TABLE}.label_name ;; } dimension: artist_name { type: string view_label: "Artist" label: "Artist Name" description: "Artist Name corresponding to ISRC" sql: ${TABLE}.artist_name ;; } dimension: track_name { type: string view_label: "Track" label: "Track Name" description: "Track name corresponding to ISRC" sql: ${TABLE}.track_name ;; } dimension: genre { type: string view_label: "Release" label: "Genre" description: "Genre corresponding to ISRC" sql: ${TABLE}.genre ;; } dimension: release_year { type: string view_label: "Release" label: "Release Year" description: "Release year" sql: ${TABLE}.release_year ;; } dimension: lift_needed { type: number view_label: "Lift" label: "Lift Needed" description: "Lift required to break even" value_format: "0.00\%" sql: ${TABLE}.lift_needed * 100 ;; } dimension_group: start_date { view_label: "Date" label: "Start" type: time sql: ${TABLE}.start_date ;; description: "Start date of DM participation" timeframes: [year, quarter, month, week, date, day_of_year, day_of_week, week_of_year, month_name, month_num, fiscal_month_num, fiscal_quarter, fiscal_quarter_of_year, fiscal_year] } dimension_group: end_date { view_label: "Date" label: "End" type: time sql: ${TABLE}.end_date ;; description: "End date of DM participation" timeframes: [year, quarter, month, week, date, day_of_year, day_of_week, week_of_year, month_name, month_num, fiscal_month_num, fiscal_quarter, fiscal_quarter_of_year, fiscal_year] } dimension: Spotify_source { type: string view_label: "Source of Stream" label: "Source Name (Original Values)" description: "Original source of stream values given by Spotify" sql: ${TABLE}.spotify_source ;; } dimension_group: activity_date { view_label: "Date" label: "Activity" type: time sql: ${TABLE}.Activity_date ;; description: "The date when activity occured" timeframes: [year, quarter, month, week, date, day_of_year, day_of_week, week_of_year, month_name, month_num, fiscal_month_num, fiscal_quarter, fiscal_quarter_of_year, fiscal_year] } measure: Max_Activity_Date { view_label: "Date" label: "Max Activity Date" description: "The latest activity date for dimension being measured" type: date sql: MAX(${TABLE}.activity_date) ;; } measure: streams { type: sum view_label: "Streams" label: "Streams" description: "Total streams" sql: ${TABLE}.streams ;; } measure: discovery_streams { type: sum view_label: "Streams" label: "Discovery Streams" description: "First time streams by User" sql: ${TABLE}.discovery_streams ;; } measure: unique_users { type: average view_label: "Users" label: "Unique Users" description: "Unique number of daily listeners" sql: ${TABLE}.discovery_streams ;; } measure: streams_ma_7_days { type: average view_label: "Streams" label: "Streams (7-Day Moving Average)" description: "7-Day moving average" sql: ${TABLE}.streams_ma_7_days ;; } measure: discovery_streams_ma_7_days { type: average view_label: "Streams" label: "Discovery Streams (7-Day Moving Average)" description: "7-day moving average" sql: ${TABLE}.discovery_streams_ma_7_days ;; } }