view: anr_spotify { derived_table: { sql: SELECT SP.ARTIST, SP.CURRENT_FOLLOWERS_COUNT AS "Spoti Followers", SP.WEEKLY_CHANGE_IN_FOLLOWERS AS "Spoti Followers Change", SP.CURRENT_WEEKLY_CHANGE_IN_FOLLOWERS AS "Spoti C. Followers Change", SP.DAILY_CHANGE_IN_FOLLOWERS AS "Spoti Followers Daily Change", TRY_TO_NUMBER(SP.MONTHLY_LISTENERS) AS "Spoti Monthly Listeners", TRY_TO_NUMBER(SP.WEEKLY_CHANGE_IN_MONTHLY_LISTENERS) AS "Spoti Monthly Listeners Change", TRY_TO_NUMBER(SP.CURRENT_WEEKLY_CHANGE_IN_MONTHLY_LISTENERS) AS "Spoti C. Monthly Listeners Change", TRY_TO_NUMBER(SP.DAILY_CHANGE_IN_MONTHLY_LISTENERS) AS "Spoti Monthly Listeners Daily Change", ROUND(100 * SP.PERCENTAGE_CHANGE_IN_MONTHLY_LISTENERS, 2) AS "% Spoti Monthly Listeners Growth", ROUND(100 * SP.ACCELERATION_MONTHLY_LISTENERS, 2) AS "% Spoti ML Acceleration", ROUND(100 * SP.PERCENTAGE_CHANGE_IN_FOLLOWERS, 2) AS "% Spoti Followers Growth", ROUND(100 * SP.ACCELERATION_FOLLOWERS, 2) AS "% Spoti F. Acceleration", SP.SPOTIFY_POPULARITY AS "Popularity", SP.EDITORIAL_PLAYLISTS_ADDS_COUNT AS "Editorial Playlists", SP.EDITORIAL_PLAYLISTS_ADDS_COUNT - SP.LAST_WEEK_EDITORIAL_PLAYLISTS_ADDS_COUNT AS "Editorial Playlists Change", SP.NOTABLE_PLAYLISTS_ADDS_COUNT AS "Notable Playlists", SP.NOTABLE_PLAYLISTS_ADDS_COUNT - SP.LAST_WEEK_NOTABLE_PLAYLISTS_ADDS_COUNT AS "Notable Playlists Change", SP.THE_LATEST_RELEASE AS "Latest Release", TRY_TO_NUMBER(SP.MONTHLY_LISTENERS) - TRY_TO_NUMBER(SP.CURRENT_WEEKLY_CHANGE_IN_MONTHLY_LISTENERS) AS "Last Week ML", SP.LAST_PROCESSING_DATE FROM TABLE({% parameter stats_table_name %}) SP WHERE SP.LAST_PROCESSING_DATE >= DATEADD( 'day', -29, CURRENT_DATE() ) AND SP.ARTIST IN (SELECT ARTIST FROM TABLE({% parameter artist_table_name %}));; } dimension: artist { type: string sql: ${TABLE}.ARTIST;; } dimension: spotify_followers { type: number sql: ${TABLE}."Spoti Followers";; } dimension: spotify_followers_change { type: number sql: ${TABLE}."Spoti Followers Change";; } dimension: spotify_c_followers_change { type: number sql: ${TABLE}."Spoti C. Followers Change";; } dimension: spotify_followers_daily_change { type: number sql: ${TABLE}."Spoti Followers Daily Change";; } dimension: spotify_monthly_listeners { type: number sql: ${TABLE}."Spoti Monthly Listeners";; } dimension: spotify_monthly_listeners_change { type: number sql: ${TABLE}."Spoti Monthly Listeners Change";; } dimension: spotify_c_monthly_listeners_change { type: number sql: ${TABLE}."Spoti C. Monthly Listeners Change";; } dimension: spotify_monthly_listeners_daily_change { type: number sql: ${TABLE}."Spoti Monthly Listeners Daily Change";; } dimension: last_week_spotify_monthly_listeners { type: number sql: ${TABLE}."Last Week ML";; } dimension: spotify_monthly_listeners_growth { type: number sql: ${TABLE}."% Spoti Monthly Listeners Growth";; } dimension: spotify_monthly_listeners_acceleration { type: number sql: ${TABLE}."% Spoti ML Acceleration";; } dimension: spotify_followers_growth { type: number sql: ${TABLE}."% Spoti Followers Growth";; } dimension: spotify_followers_acceleration { type: number sql: ${TABLE}."% Spoti F. Acceleration";; } dimension: spotify_popularity { type: number sql: ${TABLE}."Popularity";; } dimension: editorial_playlists_nulls_last { type: number sql: CASE WHEN ${spotify_editorial_playlists} is NULL THEN 0 ELSE ${spotify_editorial_playlists} END ;; } dimension: spotify_editorial_playlists { type: number sql: ${TABLE}."Editorial Playlists";; order_by_field: editorial_playlists_nulls_last } dimension: editorial_playlists_change_nulls_last { type: number sql: CASE WHEN ${spotify_editorial_playlists_change} is NULL THEN 0 ELSE ${spotify_editorial_playlists_change} END ;; } dimension: spotify_editorial_playlists_change { type: number sql: ${TABLE}."Editorial Playlists Change";; order_by_field: editorial_playlists_change_nulls_last } dimension: notable_playlists_nulls_last { type: number sql: CASE WHEN ${spotify_notable_playlists} is NULL THEN 0 ELSE ${spotify_notable_playlists} END ;; } dimension: spotify_notable_playlists { type: number sql: ${TABLE}."Notable Playlists";; order_by_field: notable_playlists_nulls_last } dimension: notable_playlists_change_nulls_last { type: number sql: CASE WHEN ${spotify_notable_playlists_change} is NULL THEN 0 ELSE ${spotify_notable_playlists_change} END ;; } dimension: spotify_notable_playlists_change { type: number sql: ${TABLE}."Notable Playlists Change";; order_by_field: notable_playlists_change_nulls_last } dimension: spotify_release { type: date sql: ${TABLE}."Latest Release";; } dimension: last_processing_date { type: date sql: ${TABLE}.LAST_PROCESSING_DATE;; } parameter: stats_table_name { type: string view_label: "Table Name" default_value: "FACTS.PROD.SPOTIFY_STATISTICS" } parameter: artist_table_name { type: string view_label: "Artist Table Name" default_value: "FACTS.PROD.ARTIST_TO_TRACK" } }