Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 Name | Employee ID | Qualification 1 (Has QualificationCode 987 or 654) | Qualification 2 (Has QualificationCode 444) |
| Bob Jones | 123 | 1 | 0 |
| Mary Smith | 456 | 1 | 1 |
EmployeeDetailsTable
| EmployeeName | EmployeeID | QualificationCode |
| Bob Jones | 123 | 987 |
| Bob Jones | 123 | 654 |
| Mary Smith | 456 | 555 |
| Mary Smith | 456 | 444 |
| Mary Smith | 456 | 987 |
Solved! Go to Solution.
Hi @tomperro,
You can follow the belwo steps
1. Load both tables into Power Query
2. Merge Queries
In EmployeeTable:
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 04. Transform the Qualification columns data type to Whole number.
5. Group to Aggregate Flags per Employee
Now, group by EmployeeID and EmployeeName, and use Max aggregation on Qualification1 and Qualification2.
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.
Hi @tomperro
Thank you for using Microsoft Community Forum.
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.
Hi @tomperro,
You can follow the belwo steps
1. Load both tables into Power Query
2. Merge Queries
In EmployeeTable:
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 04. Transform the Qualification columns data type to Whole number.
5. Group to Aggregate Flags per Employee
Now, group by EmployeeID and EmployeeName, and use Max aggregation on Qualification1 and Qualification2.
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.
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 ;). |
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 48 | |
| 43 | |
| 39 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 68 | |
| 63 | |
| 31 | |
| 30 | |
| 23 |