Forum Discussion

Diana_Jardim100's avatar
Diana_Jardim100
Frequent Visitor
3 years ago
Solved

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

Second table 

  • 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]
        )
    )

2 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

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