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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Anonymous
Not applicable

how to check if a value in column a is found in column b using a dax function

Hello,

 

I have a table which contains employeeName, EmployeeID, ManagerName and ManagerID.  I wonder if there is a DAX function I can use to check if an EmployeeID correspond to ManagerID and Put a value of 1 is manager or 0 is not.

 

Regards

1 ACCEPTED SOLUTION
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous ,

 

try this.

 

IsManager = IF ( CONTAINS ( 'Table', 'Table'[ManagerID], 'Table'[EmployeeID] ), 1, 0 )

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support. 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


View solution in original post

4 REPLIES 4
mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous ,

 

try this.

 

IsManager = IF ( CONTAINS ( 'Table', 'Table'[ManagerID], 'Table'[EmployeeID] ), 1, 0 )

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support. 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Anonymous
Not applicable

HI @Anonymous ,

 

Column 2 = if(CONTAINS('Table', 'Table'[empID], 'Table'[ManID]),1,0)
 
This will check if empID is anywhere in the MANID and if so it will gives 1 else 0.
 
 
Thanks,
Tejaswi
amitchandak
Super User
Super User

Try creating a new measure

if(isblank(countx(filter(emp,emp[EmployeeID]=earlier(emp[ManagerID])),earlier(emp[ManagerID]))),0,1)

Validate that this not giving 0
countx(filter(emp,emp[EmployeeID]=earlier(emp[ManagerID])),earlier(emp[ManagerID])))

 

if countx give 0 handle that too.

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Create a calculated column as below

 

= if(table[EmployeeID]=table[ManagerID], 1,0)

 

You could do this in Query editor as well with custom column.

 

If this helps mark it as solution

Kudos are nice too

Connect on LinkedIn

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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