Measuring # of impressions of online "real" estate


#1
 measure: advertisers {
    type: count_distinct
    sql: ${TABLE}.advertiser_id ;;
  }

  measure: sponsored_placement_impressions {
    type: count_distinct
    sql: ${TABLE}.impression_id ;;

    filters: {
      field: is_sponsored_impression
      value: "yes"
    }
  }

  measure: organic_placement_impressions {
    type: count_distinct
    sql: ${TABLE}.impression_id ;;

    filters: {
      field: is_sponsored_impression
      value: "no"
    }
  }

  measure: total.placement_impressions {
    type: number
    sql: ${sponsored_placement_impressions} + ${organic_placement_impressions} ;;
  }

  measure: impressions {
    type: count_distinct
    sql: ${TABLE}.widget_id ;;
    drill_fields: [-impressions, sponsored_placement_impressions, organic_placement_impressions]
  }