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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount 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.

August 2025 community update carousel

Fabric Community Update - August 2025

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