Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Payment Gateway Decline Analysis

I get a csv dump of Payment Gateway with thousands upon thousand of records weekly.  Here is a sample set of transactions Where James Smith has bought 5 different products / subscriptions. James has ...
  • v-kelly-msft's avatar
    5 years ago

    Hi  Anonymous ,

     

    Create following measures:

    min date = CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),'Table'[Customer ID]=MAX('Table'[Customer ID])&&'Table'[Status]="Declined"))
    max date = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[Custom]=MAX('Table'[Custom])&&'Table'[Status]="Declined"))
    _check = IF(MAX('Table'[Date])='Table'[min date],1,0)
    _check2 = IF(MAX('Table'[Date])<='Table'[max date]&&MAX('Table'[Date])>='Table'[min date],1,0)
    Total Amount = CALCULATE(SUM('Table'[Custom]),FILTER(ALL('Table'),'Table'[Customer ID]=MAX('Table'[Customer ID])&&'Table'[Date]=SELECTEDVALUE('Table'[Date])))

    And you will see:

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!