From d6617132a4df96efc8bf5a8f8ae0eb571ce73f1d Mon Sep 17 00:00:00 2001 From: Frank Bertsch Date: Wed, 16 Dec 2020 18:26:55 +0000 Subject: [PATCH] Fenix Growth Accounting Explore --- models/fenix_release.model.lkml | 5 ++ views/growth_accounting.view.lkml | 135 ++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 views/growth_accounting.view.lkml diff --git a/models/fenix_release.model.lkml b/models/fenix_release.model.lkml index 38720b2..4ea3a51 100644 --- a/models/fenix_release.model.lkml +++ b/models/fenix_release.model.lkml @@ -82,3 +82,8 @@ explore: funnel_analysis { ] } } + + +explore: growth_accounting { + +} diff --git a/views/growth_accounting.view.lkml b/views/growth_accounting.view.lkml new file mode 100644 index 0000000..471463d --- /dev/null +++ b/views/growth_accounting.view.lkml @@ -0,0 +1,135 @@ +include: "/views/*.view.lkml" + +view: growth_accounting { + extends: [baseline_clients_last_seen] + + measure: last_updated_date { + sql: MAX(${submission_raw}) ;; + hidden: yes + } + + dimension: active_this_week { + sql: mozfun.bits28.active_in_range(days_seen_bits, -6, 7) ;; + type: yesno + } + + dimension: active_last_week { + sql: mozfun.bits28.active_in_range(days_seen_bits, -13, 7) ;; + type: yesno + } + + dimension: new_this_week { + sql: DATE_DIFF(${submission_date}, first_run_date, DAY) BETWEEN 0 AND 6 ;; + type: yesno + } + + dimension: new_last_week { + sql: DATE_DIFF(${submission_date}, first_run_date, DAY) BETWEEN 7 AND 13 ;; + type: yesno + } + + measure: overall_active_previous { + type: count + filters: [active_last_week: "yes"] + } + + measure: overall_active_current { + type: count + filters: [active_this_week: "yes"] + } + + measure: overall_resurrected { + type: count + filters: [new_last_week: "no", new_this_week: "no", active_last_week: "no", active_this_week: "yes"] + } + + measure: new_users { + type: count + filters: [new_this_week: "yes", active_this_week: "yes"] + } + + measure: established_users_returning { + type: count + filters: [new_last_week: "no", new_this_week: "no", active_last_week: "yes", active_this_week: "yes"] + } + + measure: new_users_returning { + type: count + filters: [new_last_week: "yes", active_last_week: "yes", active_this_week: "yes"] + } + + measure: new_users_churned_count { + type: count + filters: [new_last_week: "yes", active_last_week: "yes", active_this_week: "no"] + hidden: yes + } + + measure: established_users_churned_count { + type: count + filters: [new_last_week: "no", new_this_week: "no", active_last_week: "yes", active_this_week: "no"] + hidden: yes + } + + measure: new_users_churned { + type: number + sql: -1 * ${new_users_churned_count} ;; + } + + measure: established_users_churned { + type: number + sql: -1 * ${established_users_churned_count} ;; + } + + measure: overall_churned { + type: number + sql: ${new_users_churned} + ${established_users_churned} ;; + } + + measure: overall_retention_rate { + type: number + sql: SAFE_DIVIDE((${established_users_returning} + ${new_users_returning}), ${overall_active_previous}) ;; + } + + measure: established_user_retention_rate { + type: number + sql: SAFE_DIVIDE( + ${established_users_returning}, + (${established_users_returning} + ${established_users_churned_count}) + );; + } + + measure: new_user_retention_rate { + type: number + sql: SAFE_DIVIDE(${new_users_returning}, (${new_users_returning} + ${new_users_churned_count})) ;; + } + + measure: overall_churn_rate { + type: number + sql: SAFE_DIVIDE((${established_users_churned_count} + ${new_users_churned_count}), ${overall_active_previous}) ;; + } + + measure: fraction_of_active_resurrected { + type: number + sql: SAFE_DIVIDE(${overall_resurrected}, ${overall_active_current}) ;; + } + + measure: fraction_of_active_new { + type: number + sql: SAFE_DIVIDE(${new_users}, ${overall_active_current}) ;; + } + + measure: fraction_of_active_established_returning { + type: number + sql: SAFE_DIVIDE(${established_users_returning}, ${overall_active_current}) ;; + } + + measure: fraction_of_active_new_returning { + type: number + sql: SAFE_DIVIDE(${new_users_returning}, ${overall_active_current}) ;; + } + + measure: quick_ratio { + type: number + sql: SAFE_DIVIDE((${new_users} + ${overall_resurrected}), (${established_users_churned_count} + ${new_users_churned_count})) ;; + } +}