Skip to content

Feature/financial metrics clv revenue #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ijac13
Copy link

@ijac13 ijac13 commented Apr 7, 2025

Trust Issues: How Jaffle Shop Rebuilt Stakeholder Confidence with Recce

📌 Summary

This PR resolves a critical issue in how revenue and customer lifetime value (CLV) were being calculated across the customers, customer_segments, customer_order_pattern, and finance_revenue models.

We identified that:

  • All order statuses were included in revenue and CLV metrics—including unfulfilled or returned orders.
  • Coupon payments were mistakenly treated as revenue, inflating metrics across both marketing and finance reports.
    This broke trust in our data. Both marketing and finance were misled for months.

✅ Solution

We’ve introduced three key changes:

  1. Filter for completed orders only
    • Ensures only fulfilled purchases are included in CLV and revenue.
  2. Add net_customer_lifetime_value
  • Captures actual revenue (excluding coupon payments).
  • Existing dashboards using gross CLV remain functional.
  1. Create finance_revenue model
  • Gross and net revenue metrics are now clearly separated.
  • Accurate reporting for finance, without mixing marketing assumptions.

👁️ Impacted and validation

  • See modified models in Recce Summary

  • With these 4 modified models, only customer_segments is impacted. See Breaking Change Analysis + Column-Level Lineage in Recce: Apr 7 Screenshot from Notion

  • Validation checks are included in Checklist

Supporting Resources

@ijac13 ijac13 requested a review from even-wei April 7, 2025 09:15
@even-wei even-wei changed the base branch from duckdb to main April 7, 2025 09:18
Copy link

github-actions bot commented Apr 7, 2025

Recce Summary

Manifest Information

Manifest Catalog
Base 2025-04-20 00:20:27 2025-04-20 00:20:28
Current 2025-04-21 02:10:44 2025-04-21 02:10:45

Lineage Graph

graph LR
model.jaffle_shop.stg_payments["stg_payments

[What's Changed]
Code, Schema"]
style model.jaffle_shop.stg_payments stroke:#ffa502
model.jaffle_shop.stg_payments---->model.jaffle_shop.orders
model.jaffle_shop.stg_payments---->model.jaffle_shop.customers
model.jaffle_shop.stg_payments-...->model.jaffle_shop.finance_revenue
model.jaffle_shop.customers["customers

[What's Changed]
Code, Schema, Value Diff, Profile Diff"]
style model.jaffle_shop.customers stroke:#ffa502
model.jaffle_shop.customers---->model.jaffle_shop.customer_order_pattern
model.jaffle_shop.customers---->model.jaffle_shop.customer_segments
model.jaffle_shop.customer_segments["customer_segments

[What's Changed]
Code, Schema, Top K Diff"]
style model.jaffle_shop.customer_segments stroke:#ffa502
model.jaffle_shop.orders["orders

[What's Changed]
"]
model.jaffle_shop.finance_revenue["finance_revenue

[What's Changed]
Added Node"]
style model.jaffle_shop.finance_revenue stroke:#1dce00
model.jaffle_shop.customer_order_pattern["customer_order_pattern"]

Loading

Checks Summary

Checks Run Data Mismatch Detected Incomplete Checks
9 6 2

⚠️ Incomplete Checks refers to checks that did not successfully run due to configuration or SQL errors.
Please check the output of recce run for more information

Checks of Data Mismatch Detected

Name Type Mismatched Nodes
Model schema of customers, orders and modified nodes Schema Diff customer_segments, finance_revenue, and 2 more nodes
Row count of customers, orders and modified table model Row Count Diff finance_revenue
Value diff of customers Value Diff customers
Query diff of customers avg lifetime value Query Diff N/A
Profile diff of customers Profile Diff customers
Top-k diff of customer_segments.value_segment Top K Diff customer_segments

See PR page: https://cloud.datarecce.io/DataRecce/jaffle_shop_duckdb/pulls/46

How to check the recce result

# Launch the recce server based on the state file
recce server --review --cloud --password yummy_jaffle

# Open the recce server http://localhost:8000 by your browser

Signed-off-by: popcorny <[email protected]>
@popcornylu popcornylu force-pushed the feature/financial-metrics-clv-revenue branch from fcbc4e5 to 4f2a4c4 Compare April 21, 2025 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants