Forum Discussion

rsrajkumar's avatar
rsrajkumar
Icon for Helper I rankHelper I
1 year ago
Solved

DAX expression to look values between 2 tables

Hi, I have 2 tables. If the Case Number from Table1 is found in Table 2, it should return a 1 in the Status Column, else it should return a 0 in the Status Column. Table2 can have duplicated rows fo...
  • SamsonTruong's avatar
    1 year ago

    Hi rsrajkumar ,

    This can be achieved through a calculated column in Table 1. Here's a DAX expression that will return 1 if the case number exists in Table2, and 0 otherwise:

    Status = 
    IF(
        CONTAINS(Table2, Table2[Case Number], Table1[Case Number]),
        1,
        0
    )

     

    If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

    Thanks,

    Samson





  • SamsonTruong's avatar
    SamsonTruong
    1 year ago

    Hi rsrajkumar , would you be able to send the DAX expression you are leveraging for the calculated column?

    Alternatively, you could use a lookup:

    Status = 
    IF(
        NOT ISBLANK(
            LOOKUPVALUE(Table2[Case Number], Table2[Case Number], Table1[Case Number])
        ),
        1,
        0
    )

     

    If this helped, please mark it as the solution so others can benefit too. And if you found it useful, kudos are always appreciated.

    Thanks,

    Samson