Skip to content

Joost Boonzajer Flaes via Elementary: Fix: Convert historical_orders monetary amounts from cents to dollars#890

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

Joost Boonzajer Flaes via Elementary: Fix: Convert historical_orders monetary amounts from cents to dollars#890
joostboon wants to merge 1 commit intomasterfrom
elementary-fix/historical-orders-cents-to-dollars-739264

Conversation

@joostboon
Copy link
Copy Markdown
Collaborator

Problem\n\nThe historical_orders model outputs all monetary columns (amount, credit_card_amount, coupon_amount, bank_transfer_amount, gift_card_amount) in cents, while real_time_orders already converts them to dollars using the cents_to_dollars macro.\n\nSince the orders model unions both tables, this creates a 100× scale mismatch in the amount column, which propagates through:\norderscustomer_conversionsattribution_touchescpa_and_roas\n\nThis causes the RETURN_ON_ADVERTISING_SPEND anomaly test to fail continuously (incident with 71+ failure events since Oct 2025).\n\n## Fix\n\n- historical_orders.sql: Apply cents_to_dollars() macro to all monetary columns, matching the pattern in real_time_orders.\n- real_time_orders.sql: Add a clarifying comment (no logic changes).\n\n## Related\n\n- Incident: column_anomalies - Average on cpa_and_roas.RETURN_ON_ADVERTISING_SPEND (HIGH severity)\n- JIRA: JSO-1"

Created by: joost@elementary-data.com

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