dating_platform/customer_loyalty_metrics.view.lookml 15 dims0 measures 3 warnings Repo files

LookML view · dating-platform

The user_tenure_metrics view: activity at day 1, 3 and 7 in one derived table

At a glance

Does
Cross joins users with a numbers table for tenure 1, 3 and 7, then sums 30-day lifecycle metrics (photos, dates posted, views, messages, replies) up to each tenure.Trust: Source-defined
Why
Early-engagement benchmarks: what a user has done by day 1, 3 and 7, for activation analysis and for comparing experiment buckets.Trust: Inferred
Breaks
3 warnings. Top: The primary key is not unique
Grain
One row per user per tenure, so three rows per user. The declared primary key is id alone, which is not unique.Trust: Source-defined
Source
dating_platform/customer_loyalty_metrics.view.lookml 85 lines
Source: customer_loyalty_metrics.view.lookml L1-10
dating_platform/customer_loyalty_metrics.view.lookmlL1-10
- view: user_tenure_metrics  derived_table:    sql: |      SELECT  users.id,              table_of_numbers.i AS tenure,              SUM(COALESCE(M.photo_uploads,0)) AS photo_uploads,              MAX(COALESCE(M.has_conversion,0)) AS has_conversion,              SUM(COALESCE(M.unique_dates_posted,0)) AS unique_dates_posted,              SUM(COALESCE(M.dates_posted,0)) AS dates_posted,              SUM(COALESCE(M.profile_views,0)) AS profile_views,              SUM(COALESCE(M.quick_views,0)) AS quick_views,              SUM(COALESCE(M.sent_messages,0)) AS sent_messages,              SUM(COALESCE(M.sent_messages_from_speed_date,0)) AS messages_sent_from_speed_date,

dating-platform, customer_loyalty_metrics.view.lookml, lines 1-10

Shape

Trust: Source-defined

Every field as declared, with the dashboard tiles that read it. Computed from the source; nothing here is edited.

Derived table: persists for 24 hour. Reads warehouse tables directly.

Dimensions 15

NameTypeSQLUsed byTags
idL36string${TABLE}.id-primary keyhidden
tenureL40int${TABLE}.tenure-
photo_uploads_by_tenureL43number${TABLE}.photo_uploads-hidden
unique_dates_posted_by_tenureL47number${TABLE}.unique_dates_posted_by_tenure (default)-implicit sql
dates_posted_by_tenureL49number${TABLE}.dates_posted-
has_conversion_by_tenureL52yesno${TABLE}.has_conversion-
questions_answered_by_tenureL55number${TABLE}.questions_answered-
messages_sent_by_tenureL58number${TABLE}.sent_messages-
replies_received_by_tenureL61number${TABLE}.replies_received-
intrigues_sent_from_speed_date_by_tenureL64number${TABLE}.intrigues_sent_from_speed_date-
messages_sent_from_speed_date_by_tenure_by_tenureL67number${TABLE}.messages_sent_from_speed_date-
profile_views_by_tenureL70number${TABLE}.profile_views-
quick_views_by_tenureL73number${TABLE}.quick_views-
messages_received_from_date_stream_by_tenureL76int
${TABLE}.messages_received_from_date_stream_by_tenure...${TABLE}.messages_received_from_date_stream_by_tenure (default)
-hiddenimplicit sql
date_responses_receieved_by_tenureL79int${TABLE}.date_responses_receieved_by_tenure (default)-hiddenimplicit sql

Relationships

Trust: Source-defined
Relationships of user_tenure_metrics
Relationships of user_tenure_metrics. Text version follows the diagram.This viewUsed by: explores, views, dashboardsas user_tenure_metrics, fk user_metrics.id tests explore in enterprise
  • This Block
  • No relationship declared
Text version
  • user_tenure_metrics is joined into tests: as user_tenure_metrics, fk user_metrics.id (no relationship declared)

Worth noticing

Tenure 1 only includes day 0

Trust: Inferred

Metrics join on M.lifecycle_day < table_of_numbers.i. If lifecycle days start at 0, tenure 1 sums day 0 only and tenure 7 sums days 0 to 6.

Source: customer_loyalty_metrics.view.lookml L20-26
dating_platform/customer_loyalty_metrics.view.lookmlL20-26
              SUM(COALESCe(M.date_responses_receieved, 0)) AS date_responses_receieved,              SUM(COALESCE(M.messages_received_from_date_stream, 0)) AS messages_received_from_date_stream,              SUM(COALESCE(M.impressions, 0)) AS impressions      FROM    users              JOIN table_of_numbers              ON  table_of_numbers.i <= DATEDIFF(DAY, users.created_at, GETDATE())              LEFT JOIN ${TABLE}.user_lifecycle_metrics_30_days M              ON  M.id = users.id                  AND M.lifecycle_day < table_of_numbers.i      WHERE   table_of_numbers.i IN (1,3,7)      GROUP BY  users.id,                table_of_numbers.i      ORDER BY users.id DESC

dating-platform, customer_loyalty_metrics.view.lookml, lines 20-26

There are no measures

Trust: Source-defined

Every field is a dimension. To total or average activity by tenure, a reader has to add measures or export rows.

Source: customer_loyalty_metrics.view.lookml L40-51
dating_platform/customer_loyalty_metrics.view.lookmlL40-51
    primary_key: true    hidden: true    sql: ${TABLE}.id  - dimension: tenure    type: int    sql: ${TABLE}.tenure  - dimension: photo_uploads_by_tenure    type: number    sql: ${TABLE}.photo_uploads    hidden: true  - dimension: unique_dates_posted_by_tenure    type: number  - dimension: dates_posted_by_tenure    type: number    sql: ${TABLE}.dates_posted  - dimension: has_conversion_by_tenure    type: yesno    sql: ${TABLE}.has_conversion

dating-platform, customer_loyalty_metrics.view.lookml, lines 40-51

What can change the answer 3

Caution: The primary key is not unique

Trust: Source-defined

id is the primary key, but each user appears three times, once per tenure. Symmetric aggregates rely on that key being unique.

What goes wrong: Any measure added to this view, or a join to it, can triple counts per user.

Read the guide: Primary keys and counts

Source: customer_loyalty_metrics.view.lookml L36-42
dating_platform/customer_loyalty_metrics.view.lookmlL36-42
    - id    - tenure  fields:  - dimension: id    primary_key: true    hidden: true    sql: ${TABLE}.id  - dimension: tenure    type: int    sql: ${TABLE}.tenure  - dimension: photo_uploads_by_tenure    type: number    sql: ${TABLE}.photo_uploads

dating-platform, customer_loyalty_metrics.view.lookml, lines 36-42

Caution: Three fields read columns the derived table does not produce

Trust: Source-defined

unique_dates_posted_by_tenure, messages_received_from_date_stream_by_tenure and date_responses_receieved_by_tenure have no sql, so they default to ${TABLE}.<field name>. The derived table outputs unique_dates_posted and the other columns without the _by_tenure suffix.

What goes wrong: Selecting any of them fails with an unknown column error.

Read the guide: Missing tables and stale references

Source: customer_loyalty_metrics.view.lookml L76-81
dating_platform/customer_loyalty_metrics.view.lookmlL76-81
  - dimension: quick_views_by_tenure    type: number    sql: ${TABLE}.quick_views  - dimension: messages_received_from_date_stream_by_tenure    type: int    hidden: true  - dimension: date_responses_receieved_by_tenure    type: int    hidden: true  sets:    detail:    - id

dating-platform, customer_loyalty_metrics.view.lookml, lines 76-81

Note: A doubled suffix and a misspelling

Trust: Source-defined

messages_sent_from_speed_date_by_tenure_by_tenure repeats _by_tenure, and receieved is misspelled in both the SQL and the field name.

Source: customer_loyalty_metrics.view.lookml L67-69
dating_platform/customer_loyalty_metrics.view.lookmlL67-69
  - dimension: intrigues_sent_from_speed_date_by_tenure    type: number    sql: ${TABLE}.intrigues_sent_from_speed_date  - dimension: messages_sent_from_speed_date_by_tenure_by_tenure    type: number    sql: ${TABLE}.messages_sent_from_speed_date  - dimension: profile_views_by_tenure    type: number    sql: ${TABLE}.profile_views

dating-platform, customer_loyalty_metrics.view.lookml, lines 67-69

Related

Guides built on this file

Related source files

Source model