Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

True or False when value from column A is present in Column B

Hello everyone,

I have a column that shows two different informations.

I would like to create a custom column where it will return a True/False if a value in Column A (Component) appears in Column B (Immediate Parent).


Thank you for your help and support!

  • Hi Anonymous 

     

    You can add a custom column with below code. Notice that you need to modify "Previous Step" accordingly. For example, "Changed Type" is the previous step in my example, so I used it as shown in below image. If you want to add it after "Added Conditional Column" step, you should use "Added Conditional Column" instead. 

    List.Contains(#"Previous Step"[Immediate Parent],[Component])

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Vijay_A_Verma 

      If values from Column Component is present in Column Immediate Parent, then a custom column should return as TRUE. If it is not present then FALSE.

      Thanks!

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    NewStep=let a=List.Buffer(PreviousStepName[Immediate Parent]) in Table.AddColumn(PreviousStepName,"Custom",each List.Contains(a,[Component]))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks wdx223_Daniel ,

      I receive this error when I use the formula above. Did I miss anything?

       

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi Anonymous 

     

    You can add a custom column with below code. Notice that you need to modify "Previous Step" accordingly. For example, "Changed Type" is the previous step in my example, so I used it as shown in below image. If you want to add it after "Added Conditional Column" step, you should use "Added Conditional Column" instead. 

    List.Contains(#"Previous Step"[Immediate Parent],[Component])

     

    Best Regards,
    Community Support Team _ Jing
    If this post helps, please Accept it as Solution to help other members find it.