view: cm_artist_editorials_spotify { sql_table_name: INTELLIGENCE.DBT_PROD.CM_ARTIST_EDITORIALS_SPOTIFY ;; # derived_table: { # sql:with artist_editorials as ( # #with editorials as ( # #select id as ID, playlist_id as PLAYLIST_URI, name as PLAYLIST_NAME, user_id as CURATOR, 'Spotify' as STORE #from CHARTMETRIC.RAW_DATA.SPOTIFY_PLAYLIST #where user_id = 'spotify') # #select spl.spotify_playlist, sa.cm_artist #from CHARTMETRIC.RAW_DATA.L_SPOTIFY_PLAYLIST spl #inner join editorials e on e.id = spl.spotify_playlist #inner join CHARTMETRIC.RAW_DATA.L_SPOTIFY_ARTIST sal on sal.spotify = spl.spotify #inner join CHARTMETRIC.RAW_DATA.SPOTIFY_ARTIST sa on sa.id = sal.spotify_artist #group by 1,2 #order by 1,2) # #select cm_artist, count(cm_artist) as editorial_count #from artist_editorials #group by 1 #order by 2 desc;; #} dimension: cm_artist { type: number hidden: yes sql: ${TABLE}.cm_artist ;; } dimension: editorial_count { label: "Editorial PLaylist Count" type: number sql: ${TABLE}.editorial_count ;; } }