LookML Advertising technology

Log Company Company

Log Company Company model for advertising technology.

source-preserved

Blocks

log_company_company.view.lkml · 109 lines
inferred
view: log_company_company {
  sql_table_name: public.log_company_company_v2 ;;

  dimension: ad_id {
    type: int
    sql: ${TABLE}.ad_id ;;
  }

  dimension: advertiser_id {
    type: int
    sql: ${TABLE}.advertiser_id ;;
  }

  dimension: agency_id {
    type: int
    sql: ${TABLE}.agency_id ;;
  }

  dimension: browser_id {
    type: int
    sql: ${TABLE}.browser_id ;;
  }

  dimension: campaign_id {
    type: int
    sql: ${TABLE}.campaign_id ;;
  }

  dimension: city {
    type: int
    sql: ${TABLE}.city ;;
  }

  dimension: country {
    type: int
    sql: ${TABLE}.country ;;
  }

  dimension: event_date {
    sql: cast( '20'+SUBSTRING(${TABLE}.event_date,7,2)+SUBSTRING(${TABLE}.event_date,1,2)+SUBSTRING(${TABLE}.event_date,4,2) as timestamp) ;;
  }

  dimension: event_date_time {
    sql: ${TABLE}.event_date_time ;;
  }

  dimension: event_type_id {
    type: int
    sql: ${TABLE}.event_type_id ;;
  }

  dimension: ip_attributes_id {
    type: int
    sql: ${TABLE}.ip_attributes_id ;;
  }

  dimension: platform_id {
    type: int
    sql: ${TABLE}.platform_id ;;
  }

  dimension: list_company {
    sql: ${TABLE}.list_company ;;
  }

  dimension: user_id_company {
    sql: ${TABLE}.user_id_company ;;
  }

  dimension: state {
    type: int
    sql: ${TABLE}.state ;;
  }

  dimension: user_id {
    sql: ${TABLE}.user_id ;;
  }

  dimension: screen_indicator_company {
    type: int
    sql: ${TABLE}.ind_company ;;
  }

  dimension_group: datetime {
    type: time
    timeframes: [time, date, week, month]
    sql: cast( '20'+SUBSTRING(${TABLE}.event_date,7,2)+SUBSTRING(${TABLE}.event_date,1,2)+SUBSTRING(${TABLE}.event_date,4,2) as timestamp) ;;
  }

  measure: count {
    type: count
  }

  measure: number_of_unique_users {
    type: count_distinct
    sql: ${user_id} ;;
  }

  measure: number_of_xdevice_unique_users {
    type: count_distinct
    sql: ${user_id_company} ;;
  }

  measure: unique_users_ratio {
    type: number
    value_format: "#,##0.00%"
    sql: 1 - (${number_of_xdevice_unique_users} / ${number_of_unique_users}) ;;
  }
}
log_company_company.view.lookml · 69 lines
source-preserved
- view: log_company_company
  sql_table_name: public.log_company_company_v2
  fields:
  - dimension: ad_id
    type: int
    sql: ${TABLE}.ad_id
  - dimension: advertiser_id
    type: int
    sql: ${TABLE}.advertiser_id
  - dimension: agency_id
    type: int
    sql: ${TABLE}.agency_id
  - dimension: browser_id
    type: int
    sql: ${TABLE}.browser_id
  - dimension: campaign_id
    type: int
    sql: ${TABLE}.campaign_id
  - dimension: city
    type: int
    sql: ${TABLE}.city
  - dimension: country
    type: int
    sql: ${TABLE}.country
  - dimension: event_date
    sql: cast( '20'+SUBSTRING(${TABLE}.event_date,7,2)+SUBSTRING(${TABLE}.event_date,1,2)+SUBSTRING(${TABLE}.event_date,4,2) as timestamp)
  - dimension: event_date_time
    sql: ${TABLE}.event_date_time
  - dimension: event_type_id
    type: int
    sql: ${TABLE}.event_type_id
  - dimension: ip_attributes_id
    type: int
    sql: ${TABLE}.ip_attributes_id
  - dimension: platform_id
    type: int
    sql: ${TABLE}.platform_id
  - dimension: list_company
    sql: ${TABLE}.list_company
  - dimension: user_id_company
    sql: ${TABLE}.user_id_company
  - dimension: state
    type: int
    sql: ${TABLE}.state
  - dimension: user_id
    sql: ${TABLE}.user_id
  - dimension: screen_indicator_company
    type: int
    sql: ${TABLE}.ind_company
  - dimension_group: datetime
    type: time
    timeframes:
    - time
    - date
    - week
    - month
    sql: cast( '20'+SUBSTRING(${TABLE}.event_date,7,2)+SUBSTRING(${TABLE}.event_date,1,2)+SUBSTRING(${TABLE}.event_date,4,2) as timestamp)
  - measure: count
    type: count
  - measure: number_of_unique_users
    type: count_distinct
    sql: ${user_id}
  - measure: number_of_xdevice_unique_users
    type: count_distinct
    sql: ${user_id_company}
  - measure: unique_users_ratio
    type: number
    value_format: '#,##0.00%'
    sql: 1 - (${number_of_xdevice_unique_users} / ${number_of_unique_users})

Contents

  • log_company_company.view.lkml
  • log_company_company.view.lookml