Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

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

 

1 ACCEPTED SOLUTION
tackytechtom
Super User
Super User

Hi @Anonymous ,

 

How about:

Calculated Column =
IF ( Table2[RecDate] = BLANK(), MAXX ( FILTER ( Table1, Table1[Account ID] = Table2[Account ID]), Table1[AccountingDate] ), Table2[RecDate] )

 

Does this work? 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

2 REPLIES 2
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]))

vstephenmsft_0-1649923246947.png

 

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.

tackytechtom
Super User
Super User

Hi @Anonymous ,

 

How about:

Calculated Column =
IF ( Table2[RecDate] = BLANK(), MAXX ( FILTER ( Table1, Table1[Account ID] = Table2[Account ID]), Table1[AccountingDate] ), Table2[RecDate] )

 

Does this work? 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.