view: int_prod_social_spike_stats {
  #sql_table_name: INTELLIGENCE.DBT_PROD.SOCIAL_SPIKE_STATS ;;

#derived_table:  { sql: SELECT * FROM intelligence.prod.social_spike_stats WHERE social = {% parameter social %};; }
  derived_table:  { sql: SELECT * FROM INTELLIGENCE.DBT_PROD.SOCIAL_SPIKE_STATS WHERE social = {% parameter social %};; }

dimension: date {
  type: date
  sql: ${TABLE}.date;;
}

parameter: social {
  type: string

  allowed_value: {
    value: "Twitter"
    label: "Twitter"
  }

  allowed_value: {
    value: "Instagram"
    label: "Instagram"
  }

  allowed_value: {
    value: "YouTube"
    label: "YouTube"
  }

}

#dimension: social {
#  type: string
#  sql: ${TABLE}.social ;;
#}



dimension: account_id {
  type: string
  sql: ${TABLE}.account_id ;;
}

dimension: name {
  type: string
  sql: ${TABLE}.name ;;
}

dimension: new_followers_today {
  type: number
  sql: ${TABLE}.new_followers_today ;;
}

dimension:avg_new_followers {
  type: number
  sql: ${TABLE}.avg_new_followers ;;
}

dimension: stdev_new_followers {
  type: number
  sql: ${TABLE}.stdev_new_followers ;;
}

dimension: spike_score {
  type: number
  sql: ${TABLE}.spike_score ;;
}

measure: count_spikes {
  type: count_distinct
  sql: ${TABLE}.name ;;
  drill_fields: [date, account_id,name,new_followers_today, avg_new_followers, stdev_new_followers, spike_score]
}


}
