Skip to content

Instantly share code, notes, and snippets.

@mattm
Created April 6, 2018 18:23
Show Gist options
  • Select an option

  • Save mattm/c0ec061de7df8f046a9612358c3e211b to your computer and use it in GitHub Desktop.

Select an option

Save mattm/c0ec061de7df8f046a9612358c3e211b to your computer and use it in GitHub Desktop.
Mixpanel Companies Derived Table
view: mp_companies {
derived_table: {
sql:
SELECT
distinct_id,
CAST(JSON_EXTRACT_SCALAR(properties, "$.com_id") AS INT64) AS com_id
FROM mp.event
WHERE name = "Signed Up" ;;
}
dimension: distinct_id {
type: number
sql: ${TABLE}.distinct_id ;;
hidden: yes
}
dimension: com_id {
label: "Company ID"
type: number
sql: ${TABLE}.com_id ;;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment