Skip to content

Maayan via Elementary: Fix: Convert historical_orders monetary amounts from cents to dollars#902

Open
joostboon wants to merge 1 commit intomasterfrom
elementary-fix-historical-orders-cents-to-dollars-482917
Open

Maayan via Elementary: Fix: Convert historical_orders monetary amounts from cents to dollars#902
joostboon wants to merge 1 commit intomasterfrom
elementary-fix-historical-orders-cents-to-dollars-482917

Conversation

@joostboon
Copy link
Copy Markdown
Collaborator

Problem

The historical_orders model was outputting monetary amounts in cents, while real_time_orders was already converting to dollars using the cents_to_dollars() macro. Since the orders model unions both via UNION ALL, this created a unit mismatch in the amount column.

This propagated through customer_conversionsattribution_touchescpa_and_roas, inflating the RETURN_ON_ADVERTISING_SPEND metric by ~100x and triggering ongoing anomaly detection failures (74 consecutive failures since Oct 2025).

Fix

  • historical_orders.sql: Apply cents_to_dollars() to all monetary columns, matching the existing pattern in real_time_orders.sql.
  • real_time_orders.sql: Added clarifying comment — no logic changes.

Related Incident

  • Incident: column_anomalies (average) on cpa_and_roas.RETURN_ON_ADVERTISING_SPEND
  • Severity: HIGH
  • Jira: JSO-1

    Created by: maayan+172@elementary-data.com

historical_orders.amount was in cents while real_time_orders.amount was
already in dollars. This mismatch caused a ~100x inflation in the ROAS
metric in cpa_and_roas, triggering anomaly detection failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant