Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Check conditions in two columns based on a list

 Hello , 

I've found a number of posts that seem like they should help but I haven't been able to get this to work.

following is my problem:

 

               Column 1       Column 2        Resulting Column

Row 1     Names 1         Names 2        Check if 'column 1' contains a list of names, if yes then return that name, else check 'column 2' if  it contains the same list of names, if yes then return that name, else return "NA"

 

How do I go about this syntax where I have to check each cell if it contains multiple values referencing from a diferrent table( I can also add the names since they're not that many) ? 

 

Thanks in Advance

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Adding a calculated column as below.

Column = 
VAR list =
    VALUES ( 'name list'[List] )
RETURN
    SWITCH (
        TRUE (),
        'Table'[Column1] IN list, 'Table'[Column1],
        'Table'[Column2] IN list, 'Table'[Column2],
        "not found"
    )

 

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Adding a calculated column as below.

Column = 
VAR list =
    VALUES ( 'name list'[List] )
RETURN
    SWITCH (
        TRUE (),
        'Table'[Column1] IN list, 'Table'[Column1],
        'Table'[Column2] IN list, 'Table'[Column2],
        "not found"
    )

 

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Update: It gave me the column values as I needed BUT when I made the relation between the table I ended up getting the following error "Circular dependency detected".

I had to create three conditional columns in m query as a way around as apparently Power BI does not allow to have two calculated columns that contain measures that are also based on that table. 

Anonymous
Not applicable

Thanks a lot, it worked out perfectly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors