← Back / Cases

R$ 400k+ recovered in 3 months by uncovering a cashback process failure

How reconciling transaction states against benefit rules exposed a silent cashback processing leak — projected at over R$ 2M per year.

The leak that aggregate dashboards hid

Cashback programs run across high transaction volumes and chained operational states: purchase eligibility, settlement windows, reversals, chargebacks, and final payout. When a failure affects only a narrow slice of transitions, top-line KPIs still look normal — while financial leakage compounds quietly every day.

During an investigative pass over the benefits workflow, I moved past summary reporting to reconcile raw operational events end to end.

How the anomaly surfaced

The investigation compared what the business rule required against what the process actually credited across every stage of the transaction lifecycle:

  1. Reconstruct the true event lifecycle. Mapped each state from purchase and settlement to eligibility and payout so every transaction had an auditable path.
  2. Isolate systematic rule drift in SQL. Joined expected benefit calculations against credited payouts, separating legitimate edge cases from repeatable processing errors.
  3. Validate root cause with product and operations. Walked concrete samples with process owners to confirm the bug and rule out cut-off or accounting timing artifacts before sizing the fix.
-- Illustrative (anonymized) reconciliation check pattern:
with expected_vs_credited as (
  select
    tx.transaction_id,
    tx.settlement_status,
    rules.expected_cashback_amount,
    coalesce(payout.credited_amount, 0) as credited_amount,
    coalesce(payout.credited_amount, 0) - rules.expected_cashback_amount as diff_amount
  from fact_transactions tx
  join dim_benefit_rules rules on rules.rule_id = tx.rule_id
  left join fact_cashback_payouts payout on payout.transaction_id = tx.transaction_id
)
select
  settlement_status,
  count(*) as affected_tx,
  sum(diff_amount) as total_leakage
from expected_vs_credited
where diff_amount <> 0
group by settlement_status;

Financial impact and guardrails

Fixing the process error delivered over R$ 400,000 in recovery within the first 3 months, with an annualized projection above R$ 2 million.

Just as important as the immediate fix was turning a one-off investigation into an ongoing guardrail: automated reconciliation checks now surface rule-vs-payout discrepancies early, before silent leakage can compound.

The client, proprietary rules, and internal benefits engine are anonymized for confidentiality. Impact figures reflect verified process recovery; the SQL query above illustrates the reconciliation pattern used.

Looking for a Senior Analytics Engineer, or stuck on a data problem?

Send an email or reach out on LinkedIn. I’m always glad to talk through architecture tradeoffs, slow Power BI models, or how I could help your team.