Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Subtract columns based on condition

Hello!

 

I've table with payments info. I want that field in "PaidIn" column would be empty if "PaymentDate" is empty.

 

I use below formula to calculate PaidIn:

 

PaidIn = [PaymentDate]-[InvoiceDate].

 

 

 

 

 

I try to use formula: PaidIn = IF(ISBLANK([PaymentDate]);"";[PaymentDate]-[InvoiceDate]) but it is not working.

 

Please share your thoughts how this can be solved.

 

Thanks!

  • Anonymous's avatar
    Anonymous
    8 years ago

    First make sure that the Format of your columns is in Date.

     

    Then use this formula for your calculated column:

     

    PaidIn = IF(NOT ISBLANK(Test[Payment Date]), DATEDIFF(Test[Invoice Date],Test[Payment Date],DAY))

     

    My table's name is "Test" which explains the word Test in the formula above. 

     

    Hope this helps!

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    First make sure that the Format of your columns is in Date.

     

    Then use this formula for your calculated column:

     

    PaidIn = IF(NOT ISBLANK(Test[Payment Date]), DATEDIFF(Test[Invoice Date],Test[Payment Date],DAY))

     

    My table's name is "Test" which explains the word Test in the formula above. 

     

    Hope this helps!

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, Anonymous!

      • Anonymous's avatar
        Anonymous
        Not applicable

        You're welcome. Happy to help!