Using M to Check If a Value Exists in Another Table (Power Bi)

I have 2 tables,

Table 1
Column1
Alex
Barry
Chris

Column1
Name
Miranda
Fanta
Barry

I want to remove any rows from Table 1 that is present in Table 2 in the query editor

To do this, I need to create a column called as IsPresent in Table1.

Column1  IsPresent
Alex       No
Barry      Yes
Chris      No

How can I create this IsPresent column using M? Is it even possible, if not why ?

1 Answer

You can certainly write a custom column for this

if List.Contains(Column1[Name], [Column1]) then "Yes" else "No"

However, if your goal is just "to remove any rows from Table 1 that is present in Table 2" then you can do a left anti join instead of defining a custom column and filtering.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest