Forum Discussion

Laur_entiu_st's avatar
Laur_entiu_st
Regular Visitor
3 years ago
Solved

calculate 2 values date diff

Hello,

 

I am trying to substract 2 values, based in Trx_ID and StatusAuditPayment.

So if the have same trx_id I want that value from created_at based on status "Approved" substract from value from completed_date if have the status auditpayment "Successful"

 

Thank you!

 

 

  • Hi Laur_entiu_st ,

     

    Please try:

     

    substract value = 
    var _a = MAXX(FILTER('Table',[trx_id]=EARLIER('Table'[trx_id])&&[Status AuditPayment]="Approved"),[created_at])
    var _b = MAXX(FILTER('Table',[trx_id]=EARLIER('Table'[trx_id])&&[Status AuditPayment]="Successful"),[completed_date])
    return DATEDIFF(_a,_b,MINUTE)

     

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

  • Hi Laur_entiu_st ,

     

    Please try:

     

    substract value = 
    var _a = MAXX(FILTER('Table',[trx_id]=EARLIER('Table'[trx_id])&&[Status AuditPayment]="Approved"),[created_at])
    var _b = MAXX(FILTER('Table',[trx_id]=EARLIER('Table'[trx_id])&&[Status AuditPayment]="Successful"),[completed_date])
    return DATEDIFF(_a,_b,MINUTE)

     

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.