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
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

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


View solution in original post

4 REPLIES 4

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


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

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
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.