Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Lookup with IF Condition for a Date columns

Hello,

I need help to add the Calculated Recovery Date in the Table 2 using DAX command.

Logic for Recovery Date: First it should pick the Table2[Rec Date], if Table2[Rec Date] is Null, then do a lookup on Table1[AccountingDate] and pick the MAX Table2[RecDate] group by AccountID.

Table1:

Account IDAccountingDate
101-02-2020
101-03-2020
201-04-2020
201-05-2020
301-06-2020
401-07-2020
501-08-2020
601-05-2020
701-06-2020
701-07-2020

 

Table2:

Account IDRecDateRecoveryDate
101-02-202101-02-2021
2 01-05-2020
301-04-202101-04-2021
4 01-07-2020
501-06-202101-06-2021
601-07-202101-07-2021
701-08-202101-08-2021

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    tackytechtom 's calculated column is good.

    You could also create a measure.

    Calculated Recovery Date = IF(ISBLANK(MAX('Table2'[RecDate])),MAX('Table1'[AccountingDate]),MAX('Table2'[RecDate]))

     

    Best Regards,

    Stephen Tao

     

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