File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -215,7 +215,8 @@ SELECT
215215 DATE (order_processed_at_local_datetime) AS order_date,
216216 sm_utm_source_medium,
217217 COUNT (DISTINCT sm_customer_key) AS new_customers,
218- SUM (order_net_revenue) AS revenue
218+ SUM (order_net_revenue) AS revenue,
219+ SAFE_DIVIDE(SUM (order_net_revenue), COUNT (DISTINCT sm_customer_key)) AS avg_first_order_value
219220FROM ` your_project.sm_transformed_v2.obt_orders`
220221WHERE is_order_sm_valid = TRUE
221222 AND order_sequence = ' 1st_order'
@@ -232,11 +233,11 @@ SELECT
232233 AVG (SAFE_DIVIDE(cumulative_order_net_revenue, cohort_size)) AS avg_ltv
233234FROM ` your_project.sm_transformed_v2.rpt_cohort_ltv_by_first_valid_purchase_attribute_no_product_filters`
234235WHERE sm_order_line_type = ' all_orders'
236+ AND acquisition_order_filter_dimension = ' source/medium'
235237 AND months_since_first_order <= 12
236238GROUP BY 1 , 2
237239ORDER BY 1 , 2
238240~~~
239- ```
240241
241242---
242243
You can’t perform that action at this time.
0 commit comments