Forum Discussion

raghsal's avatar
raghsal
New Member
5 years ago
Solved

Check if a value exist in another column

Hello. I need help please please.

 

I have two tables (Table1 and Table2) They both have ID column

 

I would like to check if the ID in Table 2 exist in Table 1 or not. 

 

Then I would like to create a new column in Table 1 (Exist column) with the values YES and NO.. Yes if it exists and NO if it doesn't.

 

Thanks so much

  • Hi raghsal  ,


    You could create a new column by the following formula:

     

    check =
    VAR _SEL =
    SELECTCOLUMNS ( 'Table (2)', "ID", [ID] )
    RETURN
    IF ( 'Table'[ID] IN _SEL, "YES", "NO" )

     

    The final output is shown below:


    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi raghsal  ,


    You could create a new column by the following formula:

     

    check =
    VAR _SEL =
    SELECTCOLUMNS ( 'Table (2)', "ID", [ID] )
    RETURN
    IF ( 'Table'[ID] IN _SEL, "YES", "NO" )

     

    The final output is shown below:


    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you, it was really helpful for me.