view: cm_raw_data_spotify_artist { sql_table_name: intelligence.dbt_prod.stg_cm_spotify_artist_clean ;; # derived_table: { # sql: # Select * # from (Select cm_artist as cma, max(followers_latest) as max_followers # from chartmetric.raw_data.spotify_artist # group by 1) as dta # inner join chartmetric.raw_data.spotify_artist sa on dta.cma = sa.cm_artist # and dta.max_followers = sa.followers_latest ;; # } dimension: id { type: number hidden: yes description: "Chartmetrics Spotify Artist ID used to join with other Chartmetric data (i.e cm_raw_data_spotify_artist_stat.spotify_artist)" primary_key: yes sql: ${TABLE}.id ;; } dimension: spotify_artist_id { type: string description: "The artists Spotify ID." hidden: yes sql: ${TABLE}.spotify_artist_id ;; } dimension: genres { label: "Artist Genres" description: "The artist's genre." type: string hidden: no sql: ${TABLE}.genres ;; view_label: "Spotify" } dimension: popularity_latest { label: "Artist Latest Popularity" description: "The artist's latest Spotify popularity score." type: number hidden: no sql: ${TABLE}.popularity_latest ;; view_label: "Spotify" } dimension: followers_latest { label: "Artist Latest Followers" description: "The artist's latest Spotify followers count." type: number hidden: no sql: ${TABLE}.followers_latest ;; view_label: "Spotify" } dimension: artist_name { label: "Artist Name" description: "The artist's name as it appears on Spotify." type: string hidden: yes sql: ${TABLE}.artist_name ;; view_label: "Spotify" } dimension: cm_artist { type: number hidden: yes description: "The associated Chartmetric Artist ID." sql: ${TABLE}.cm_artist ;; } dimension: description { type: string description: "The artist description from Spotify." hidden: yes sql: ${TABLE}.description ;; } dimension: artwork_url { type: string description: "The URL for the artist's image on Spotify." hidden: yes sql: ${TABLE}.artwork_url ;; } dimension_group: last_updated { type: time description: "The last date that the artist details were updated (i.e Latest Followers, Latest Popularity, Artwork URL, etc.)." hidden: yes sql: ${TABLE}.last_updated ;; timeframes: [ date, day_of_week, day_of_week_index, day_of_month, week, week_of_year, month, month_name, month_num, quarter, quarter_of_year, year ] view_label: "Spotify" } }