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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tomperro
Helper V
Helper V

Power Query Check if a value exists in another table list

I have 2 tables, employee and employee details

Employee contains a unique list of employee name and employee id. 

Employee Details has multiple rows per employee with different qualification codes.

In the employee table, I need to create columns for each qualification code that will check to see if a qualification code (or multiple codes) exists for that employee in the employee details table. 

EmployeeTable

Employee NameEmployee ID

Qualification 1 

(Has QualificationCode 987 or 654)

Qualification 2

(Has QualificationCode 444)

Bob Jones12310
Mary Smith45611

 

EmployeeDetailsTable

EmployeeNameEmployeeIDQualificationCode
Bob Jones123987
Bob Jones123654
Mary Smith456555
Mary Smith456444
Mary Smith456987
1 ACCEPTED SOLUTION
ajaybabuinturi
Solution Sage
Solution Sage

Hi @tomperro

You can follow the belwo steps

1. Load both tables into Power Query

2. Merge Queries

In EmployeeTable:

  • Merge with EmployeeDetailsTable using both EmployeeName and EmployeeID (to ensure uniqueness).
  • Use Left Outer Join.
  • Expand only QualificationCode.

ajaybabuinturi_0-1749053591281.png

3. Add Custom Columns for Qualification Flags

Now in the expanded version of EmployeeTable, add custom columns like this:

Qualification1 (987 r 654)= if [QualificationCode] = 987 or [QualificationCode] = 654 then 1 else 0
Qualification2 (444)= if [QualificationCode] = 444 then 1 else 0

4. Transform the Qualification columns data type to Whole number.

ajaybabuinturi_1-1749053890485.png

5. Group to Aggregate Flags per Employee

Now, group by EmployeeID and EmployeeName, and use Max aggregation on Qualification1 and Qualification2.

ajaybabuinturi_2-1749053911064.png

 

I am attaching a .pbix file for your reference.
https://drive.google.com/file/d/1RdCxhpSFEHK3GyvrdLly4K4UcRA9BTUI/view 

 

Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

View solution in original post

4 REPLIES 4
v-priyankata
Community Support
Community Support

Hi @tomperro 

Thank you for using Microsoft Community Forum.

Thanks @ajaybabuinturi @KNP for your inputs. @tomperro May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @tomperro 
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If any response has addressed your query, please accept it as a solution.
Thank you.

ajaybabuinturi
Solution Sage
Solution Sage

Hi @tomperro

You can follow the belwo steps

1. Load both tables into Power Query

2. Merge Queries

In EmployeeTable:

  • Merge with EmployeeDetailsTable using both EmployeeName and EmployeeID (to ensure uniqueness).
  • Use Left Outer Join.
  • Expand only QualificationCode.

ajaybabuinturi_0-1749053591281.png

3. Add Custom Columns for Qualification Flags

Now in the expanded version of EmployeeTable, add custom columns like this:

Qualification1 (987 r 654)= if [QualificationCode] = 987 or [QualificationCode] = 654 then 1 else 0
Qualification2 (444)= if [QualificationCode] = 444 then 1 else 0

4. Transform the Qualification columns data type to Whole number.

ajaybabuinturi_1-1749053890485.png

5. Group to Aggregate Flags per Employee

Now, group by EmployeeID and EmployeeName, and use Max aggregation on Qualification1 and Qualification2.

ajaybabuinturi_2-1749053911064.png

 

I am attaching a .pbix file for your reference.
https://drive.google.com/file/d/1RdCxhpSFEHK3GyvrdLly4K4UcRA9BTUI/view 

 

Thanks,
If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

KNP
Super User
Super User

Would it not be easier (and a better model design) to create a Qualifications table, join to Employee Details on the qualification code and use values from Employee and Qualifications for reporting?

 

Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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