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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
paolo_troia
Frequent Visitor

How to check if a value of a column is in another column

Hi all,

 

hope you are well!

 

I am writing to you because I would like to create a third column to check if the value of the column "ID_Primary" is present in the  column "Placement". This third column should countain a True/False or maybe should colour in red if there is not a match.

This is a an example of database I created for the purpose, but the real database is much longer, so I should find a way to match the column "ID primary" with the column "Placement".

 

In the following link you can find the .pbix and the database:

https://drive.google.com/drive/folders/1-5E58YHIjmrmC6BAgJBrcKL3z2Lxj0CX?usp=sharing

 

paolo_troia_0-1643289388067.png

Unfortunately, I cannot find a solution. Could you please check if there is a way to solve the problem?

 

Many thanks

 

Paolo

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Are you only checking if it's on the same row (i.e. not the whole column). If so,

in Power Query, add a custom column like:

Text.Contains([Column2], [Column1])

swap in your column names.

View solution in original post

4 REPLIES 4
mh2587
Super User
Super User

if both the columns are text type then recommend the following dax

3rd column =  EXACT([ID_Primary],[Placement])


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



HotChilli
Super User
Super User

Are you only checking if it's on the same row (i.e. not the whole column). If so,

in Power Query, add a custom column like:

Text.Contains([Column2], [Column1])

swap in your column names.

amitchandak
Super User
Super User

@paolo_troia , A new column

 

Measure  =

var _id = [ID primary]

return

if(isblank(countx(filter(table,[Placement] =_id),[ID primary])), 0,1)

Hi Amitchandak,

 

thanks for you feedback but unfortunately it does not work.

 

I updated the .pbix with your code but I cannot find the solution.

For example, the third row should be False or 0 because the ID primary value "179453" is not present inside the Placement "Test Test Test" row.

 

https://drive.google.com/drive/folders/1-5E58YHIjmrmC6BAgJBrcKL3z2Lxj0CX?usp=sharing

 

paolo_troia_0-1643292721021.png

 

Could you please check if there is a way to solve the problem?

 

Many thanks in advance

 

Paolo

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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