Skip to content

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

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

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

Conversation

@joostboon
Copy link
Copy Markdown
Collaborator

Problem

The historical_orders model was outputting monetary amounts in cents while real_time_orders already converts to dollars using the cents_to_dollars macro. Since the orders model unions both with UNION ALL, the resulting amount column contained mixed units — causing a 100x inflation in revenue that propagated through:\n\norderscustomer_conversionsattribution_touchescpa_and_roas\n\nThis triggered the column_anomalies (average) test on RETURN_ON_ADVERTISING_SPEND (incident HIGH severity, 84+ failure events since Oct 2025).\n\n## Fix\n\n- historical_orders.sql: Apply cents_to_dollars() macro to all monetary columns (amount, credit_card_amount, coupon_amount, bank_transfer_amount, gift_card_amount)\n- real_time_orders.sql: Added clarifying comment (no logic change)\n\n## Impact\n\nFixes the ROAS anomaly incident on cpa_and_roas and restores correct dollar-denominated values across all downstream finance and marketing models.

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

historical_orders.amount was in cents while real_time_orders.amount was
already in dollars, causing a 100x mismatch that propagated to
cpa_and_roas.return_on_advertising_spend and triggered anomaly alerts.
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