Skip to main content

Attribution Delta Root Cause Analysis

September 2025: Why Repo B Pays $1,925.71 More to Agents Than Repo A

Date: 2025-01-XX
Status: Root Cause Identified
Impact: $1,925.71 agent commission delta for September 2025

Executive Summary

Root Cause: Repo A is using incorrect PEPM rates for commission calculation, resulting in underpayment to agents. Repo B correctly uses the authoritative PEPM rates from agent2_pepm.csv. Evidence:
  • Canyon Plumbing LLC: Repo A pays 553.84total,RepoBpays553.84 total, Repo B pays 2,408.00 total
  • Agent2_PEPM authoritative rates: KEN YOUNG = 10,KENNYYOUNG=10, KENNY YOUNG = 4
  • Repo B calculation: (10×12/12)×172rows=10 × 12/12) × 172 rows = 1,720 (KEN) + (4×12/12)×172rows=4 × 12/12) × 172 rows = 688 (KENNY) = $2,408 ✅
  • Repo A calculation: 395.60(KEN)+395.60 (KEN) + 158.24 (KENNY) = 553.84(uses 553.84 ❌ (uses ~2.30 and 0.92perrowinsteadof0.92 per row instead of 10 and $4)
Conclusion: Repo B is correct; Repo A is underpaying agents.

Detailed Analysis

1. Business-Level Attribution Deltas (Top 5)

Business NameRepo A AgentRepo B AgentDeltaRoot Cause
CANYON PLUMBING LLC$553.84$2,408.00$1,854.16PEPM Rate Mismatch
HAWAIIAN HUT INC$162.00$198.00$36.00Additional agent (GREG DEAN) in Repo B
HAWAIIAN HUT II INC$90.00$110.00$20.00Additional agent (GREG DEAN) in Repo B
C&J LIQUORS LLC DBA SPIRITS WORLD$45.00$55.00$10.00Additional agent (GREG DEAN) in Repo B
NUG$3,102.45$3,108.00$5.55Rounding/timing differences (within tolerance)
Total Delta: $1,925.71 (matches parity report)

2. Deep Dive: Canyon Plumbing LLC

Agent2_PEPM Authoritative Rates

KEN YOUNG:     PEPM = $10.00
KENNY YOUNG:   PEPM = $4.00

Repo A Stage3 Breakdown

Business: CANYON PLUMBING LLC
├─ KEN YOUNG:     $395.60 (absorbed_count=172, PEPM_rate_clean=NULL)
├─ KENNY YOUNG:   $158.24 (absorbed_count=172, PEPM_rate_clean=NULL)
└─ Total:         $553.84

Calculation Implied:
  KEN YOUNG:     $395.60 / 172 = $2.30 per row
  KENNY YOUNG:   $158.24 / 172 = $0.92 per row

If normalized_pepm = $2.30, then PEPM = ($2.30 × 12) / 12 = $2.30
But agent2_pepm says PEPM = $10.00 ❌ MISMATCH

Repo B Stage3 Breakdown

Business: CANYON PLUMBING LLC
├─ KEN YOUNG:     $1,720.00 (row_count=172, employee_count=52)
├─ KENNY YOUNG:   $688.00   (row_count=172, employee_count=52)
├─ Richard Ballard: $69.59  (owner residual)
└─ Total Agent:   $2,408.00

Calculation:
  KEN YOUNG:     normalized_pepm = ($10 × 12) / 12 = $10.00
                 agent_total = $10.00 × 172 rows = $1,720.00 ✅
  
  KENNY YOUNG:   normalized_pepm = ($4 × 12) / 12 = $4.00
                 agent_total = $4.00 × 172 rows = $688.00 ✅

Root Cause: PEPM Rate Mismatch

Repo A Issue:
  • pepm_rate_clean is NULL in stage3_snapshots for Canyon Plumbing
  • Stored agent_total values (395.60,395.60, 158.24) imply PEPM rates of 2.30and2.30** and **0.92
  • These rates are incorrect (should be 10and10 and 4 per agent2_pepm)
Repo B Correct Behavior:
  • Uses PEPM rates from agent2_pepm.csv directly
  • Calculates normalized_pepm = (pepm_rate × 12) / pay_periods
  • Calculates agent_total = normalized_pepm × row_count
  • Matches authoritative agent2_pepm rates ✅

3. Row-Count Basis Check

Both Repo A and Repo B use row_count for commission calculation:
  • Repo A: agent_total = tpa_per_pay_amount × absorbed_count (where absorbed_count = surviving credit rows)
  • Repo B: agent_total = normalized_pepm × row_count (where row_count = transaction rows)
Canyon Plumbing: Both repos use 172 rows for commission calculation ✅ Employee Count:
  • Repo A: Reports 344 employees total (172 per agent)
  • Repo B: Reports 104 employees (distinct member_ids), 344 rows
  • Employee count is for reporting only; commission uses row_count ✅

4. Agent Eligibility Rules

Both repos attribute to the same agents:
  • KEN YOUNG ✅
  • KENNY YOUNG ✅
No agent exclusion differences for Canyon Plumbing. Additional Agents in Repo B (for other businesses):
  • HAWAIIAN HUT businesses: Repo B includes GREG DEAN (not in Repo A)
  • This accounts for 66totaldelta(66 total delta (36 + 20+20 + 10)

5. Reconciliation Against Dashboard Truth

Repo A Dashboard Values (from payroll_analytics.ceo_metrics):
  • Agent Payout Net: $10,534.29
  • Owner Net: $18,065.41
Repo B Engine Values:
  • Agent Payout Net: $12,460.00
  • Owner Net: $16,139.70
Delta: $1,925.71 (Repo B pays more to agents) Audit Truth:
  • Repo B uses authoritative PEPM rates from agent2_pepm.csv
  • Repo A uses incorrect/stale PEPM rates (NULL or wrong values in stage3_snapshots)
  • Repo B is correct; Repo A is underpaying agents

Root Cause Explanation

Why Does Repo B Pay $1,925.71 More to Agents?

Answer: Repo B correctly uses the authoritative PEPM rates from agent2_pepm.csv, while Repo A uses incorrect/stale PEPM rates stored in stage3_snapshots. Specific Example (Canyon Plumbing):
  1. Authoritative PEPM rates (agent2_pepm.csv):
    • KEN YOUNG: $10.00
    • KENNY YOUNG: $4.00
  2. Repo B calculation (correct):
    • KEN YOUNG: (10×12/12)×172rows=10 × 12/12) × 172 rows = **1,720.00**
    • KENNY YOUNG: (4×12/12)×172rows=4 × 12/12) × 172 rows = **688.00**
    • Total: $2,408.00
  3. Repo A calculation (incorrect):
    • KEN YOUNG: **395.60(impliesPEPM395.60** (implies PEPM ≈ 2.30)
    • KENNY YOUNG: **158.24(impliesPEPM158.24** (implies PEPM ≈ 0.92)
    • Total: $553.84
  4. Delta: 2,408.002,408.00 - 553.84 = **1,854.16(accountsfor961,854.16** (accounts for 96% of total 1,925.71 delta)
Why Repo A Has Wrong Rates:
  • pepm_rate_clean is NULL in stage3_snapshots for Canyon Plumbing
  • Stored agent_total values suggest PEPM rates of 2.30and2.30 and 0.92 (incorrect)
  • Possible causes:
    1. Stale data (stage3_snapshots loaded before PEPM rates were updated)
    2. PEPM rate lookup failure during Repo A processing
    3. Manual override or data corruption in stage3_snapshots

Decision Recommendation

Why Not:
  • Repo A is using incorrect PEPM rates
  • Matching Repo A would underpay agents by $1,925.71
  • Violates audit-grade requirement to use authoritative PEPM rates
  • Would require Repo B to ignore agent2_pepm.csv and use stale/wrong rates
Why:
  • Repo B uses authoritative PEPM rates from agent2_pepm.csv
  • Repo A uses incorrect/stale PEPM rates (NULL or wrong values)
  • Repo B calculation matches agent2_pepm rates exactly
  • Repo A calculation implies PEPM rates that don’t match agent2_pepm
Proof:
  • Canyon Plumbing: Repo A uses ~2.30and2.30 and 0.92 PEPM; agent2_pepm says 10and10 and 4
  • Repo B calculation: (10×12/12)×172=10 × 12/12) × 172 = 1,720 ✅ matches agent2_pepm
  • Repo A calculation: 395.60/172=395.60 / 172 = 2.30 per row ❌ doesn’t match agent2_pepm
Action Required:
  1. Fix Repo A to use authoritative PEPM rates from agent2_pepm.csv
  2. Regenerate Repo A stage3_snapshots for September 2025 with correct PEPM rates
  3. Re-run Repo A payroll for September to correct agent payouts
  4. Keep Repo B unchanged (it’s already correct)

Regression Guardrail

Target: September 2025 Parity

Current Status: FAIL
  • Agent Delta: $1,925.71 (Repo B > Repo A)
  • Owner Delta: -$1,925.71 (Repo B < Repo A)
  • Invariant: ✅ gross = agent + owner + chargebacks (preserved)
Target After Repo A Fix:
  • Agent Delta: ≤ $0.01 ✅
  • Owner Delta: ≤ $0.01 ✅
  • Invariant: ✅ gross = agent + owner + chargebacks
Regression Rule:
def validate_september_2025_parity(repo_a_agent, repo_b_agent, tolerance=Decimal("0.01")):
    """
    Validate that Repo A and Repo B agent payouts match within tolerance.
    
    After Repo A is fixed to use authoritative PEPM rates, this should PASS.
    """
    delta = abs(repo_b_agent - repo_a_agent)
    assert delta <= tolerance, f"Agent delta ${delta:,.2f} exceeds tolerance ${tolerance:,.2f}"
    return True

Files Modified

None - This analysis identifies that Repo B is correct and Repo A needs fixing.

Next Steps

  1. Fix Repo A to use authoritative PEPM rates from agent2_pepm.csv
  2. Regenerate Repo A stage3_snapshots for September 2025
  3. Re-run parity validation to confirm delta ≤ $0.01
  4. Document the fix in Repo A codebase
  5. Add regression test to prevent PEPM rate mismatches in the future

Conclusion

Repo B is paying $1,925.71 more to agents because Repo A is using incorrect PEPM rates. Repo B correctly uses the authoritative rates from agent2_pepm.csv, while Repo A uses stale/wrong rates stored in stage3_snapshots. The fix must be in Repo A, not Repo B. Repo B should remain unchanged as it correctly implements the audit-grade commission calculation using authoritative PEPM rates.