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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register 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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.