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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Diana_Jardim100
Frequent Visitor

RELATED TABLE WITH CONDITION

Hello guys, 

 

I'm trying to crate a column with  information from another table.

I tried to do a lookup but I have some duplicates so it didn't work.

The condition is: 

IF the end date is blank , then keep blank, otherwise, bring the last information contained in the second table - column (ID_TERM_REASON) 

 

First  Table

Diana_Jardim100_3-1667392733231.png

Second table 

Diana_Jardim100_2-1667392702981.png

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Diana_Jardim100 
Please try

ID_TERM_REASON =
IF (
    NOT ISBLANK ( Table1[End Date] ),
    MAXX (
        TOPN ( 1, RELATEDTABLE ( Table2 ), Table2[Date] ),
        Table2[ID_TERM_REASON]
    )
)

View solution in original post

2 REPLIES 2
Diana_Jardim100
Frequent Visitor

Many thanks.

It was exactly what I needed. 

 

tamerj1
Super User
Super User

Hi @Diana_Jardim100 
Please try

ID_TERM_REASON =
IF (
    NOT ISBLANK ( Table1[End Date] ),
    MAXX (
        TOPN ( 1, RELATEDTABLE ( Table2 ), Table2[Date] ),
        Table2[ID_TERM_REASON]
    )
)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.