Skip to end of banner
Go to start of banner

Resolved Disputes - Summary

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Description:Summary count, total dispute amount, total recovery amount, and total loss amount for disputes resolved within a specified date range. 
Sources:Dispute, Claim
SELECT
    COUNT(*) as "Resolved Disputes",
    SUM(d.amount) as "Total  Amount",
    COUNT_IF(d.losstotal < 0) as "Disputes With Losses",
    SUM(d.losstotal * -1) as "Total Loss Amount",
    COUNT_IF(d.merchanttotal < 0) as "Disputes With Recovery",
    SUM(d.merchanttotal * -1) as "Total Recovered Amount",
    COUNT_IF(d.denyreason = 'Merchant Issued Credit' AND (d.disputeamount + d.merchanttotal + d.losstotal) > 0) as "Disputes With Merchant Credit",
    SUM(CASE WHEN (d.denyreason = 'Merchant Issued Credit' AND (d.disputeamount + d.merchanttotal + d.losstotal) > 0) THEN d.disputeamount + d.merchanttotal + d.losstotal ELSE 0 END) as "Total Merchant Credits",
    SUM(CASE WHEN (d.denyreason = 'Merchant Issued Credit' AND (d.disputeamount + d.merchanttotal + d.losstotal) > 0) THEN d.disputeamount - d.accountholdertotal - (d.disputeamount + d.merchanttotal + d.losstotal) ELSE d.disputeamount - d.accountholdertotal END) as "Total Denied",
FROM
    dispute AS d
JOIN
    claim AS c ON c.tenantid = d.tenantid AND c.claimid = d.claimid
WHERE
    d.resolveddatetime =:daterange
    AND d.status in ('Resolved-Paid', 'Resolved-Denied') -- exclude open disputes and temporary authorizations that posted as these will have a new dispute record
    
    
    


  • No labels