Forum Discussion

Lily_DS's avatar
Lily_DS
Frequent Visitor
4 years ago
Solved

add new column ( true false) based on another table

Hello 

 

I have 2 tables(A , B) ,

I need to add [true , false] column to tableA

if  row in TableA same in TableB  return True

 

 

I tried this , but i got errors

 

 

= List.Contains(TableB[id], [id])

 

 

 

Thanks in advance

  • Hi,

    If you are trying to get the result in Power Query Editor, please check the below picture and the attached pbix file.

     

    = Table.AddColumn(Source, "Custom", each if List.Contains(TableB[B], [A]) then true else false)

     

2 Replies

  • Hi,

    If you are trying to get the result in Power Query Editor, please check the below picture and the attached pbix file.

     

    = Table.AddColumn(Source, "Custom", each if List.Contains(TableB[B], [A]) then true else false)

     

  • MahyarTF's avatar
    MahyarTF
    Icon for Memorable Member rankMemorable Member

    Hi,

    I used the List.positionof function in power query as below :

    I did create the below custom column in Power query :

    1- the first table (Sheet181) :

    2- Sheet180 :

    3- in Sheet181, add new Custom Column :

    = Table.AddColumn(#"Changed Type", "ExistValue", each if List.PositionOf(Sheet180[Name],[#"Name "]) >= 0 then true else false)

    Then use it in the visual :

    Appreciate your Kudos