Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I have 3 tables - Employee, Tickets, TimeEntry.
Relationships are:
The Employee and Tickets table both have the EmployeeID field. The TimeEntry table has a field UserID. A Ticket record has one assigned employee, but can contain many time entries from many employees.
I am trying to retrieve the EmployeeName (from the Employee table) based on the UserID field in the TimeEntry table. There's no relationship between the Employee table and the TimeEntry table.
My PowerBI is DirectQuery, not Import. How would I to retrieve the potential many EmployeeName for the many TimeEntry associated to one Ticket?
Thanks!
Solved! Go to Solution.
Hi @check1 ,
Try merging the query twice like this and then combining the text:
let
Source = Table.NestedJoin(TimeEntry, {"Ticket ID"}, Tickets, {"Ticket ID"}, "Tickets", JoinKind.LeftOuter),
#"Expanded Tickets" = Table.ExpandTableColumn(Source, "Tickets", {"Employee ID"}, {"Employee ID"}),
#"Merged Queries" = Table.NestedJoin(#"Expanded Tickets", {"Employee ID"}, Employee, {"Employee ID"}, "Employee", JoinKind.LeftOuter),
#"Expanded Employee" = Table.ExpandTableColumn(#"Merged Queries", "Employee", {"Employee Name"}, {"Employee Name"}),
#"Grouped Rows" = Table.Group(#"Expanded Employee", {"UserID"}, {{"Employee Names", each Text.Combine( List.Distinct([Employee Name]),",")}})
in
#"Grouped Rows"
Note that the storage mode of the table for the merge query is Import.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @check1 ,
Try merging the query twice like this and then combining the text:
let
Source = Table.NestedJoin(TimeEntry, {"Ticket ID"}, Tickets, {"Ticket ID"}, "Tickets", JoinKind.LeftOuter),
#"Expanded Tickets" = Table.ExpandTableColumn(Source, "Tickets", {"Employee ID"}, {"Employee ID"}),
#"Merged Queries" = Table.NestedJoin(#"Expanded Tickets", {"Employee ID"}, Employee, {"Employee ID"}, "Employee", JoinKind.LeftOuter),
#"Expanded Employee" = Table.ExpandTableColumn(#"Merged Queries", "Employee", {"Employee Name"}, {"Employee Name"}),
#"Grouped Rows" = Table.Group(#"Expanded Employee", {"UserID"}, {{"Employee Names", each Text.Combine( List.Distinct([Employee Name]),",")}})
in
#"Grouped Rows"
Note that the storage mode of the table for the merge query is Import.
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Thank you Gao. I was able to create a merge that allowed me to pull the Employee Name. I appreciate your help!
@v-cgao-msft this solution will give all the names of the original ticket creators for each user working on tickets. This not not how I understood the question, but if this is what is required, I would follow a similar approach.
Thanks @PwerQueryKees. Hope this give a little better explanation of what I'm trying to do. A ticket is assigned to a primary employee. However, the ticket can have many time entries from many different employees. I am trying to find the name of those employees for those time entries. I can show the UserIDs for each time entry, but I'm trying to resolve the name of the employee associated with that UserID, which is the EmployeeName from the Employee table. If I link the TimeEntry and Employee table (using UserID and EmployeeID) it creates ambiguous paths.
Ok. So the user id is not an employee id. What else have you got to connect a user to an employee? Is there a user table you can use? Is there another filed, like email address you can use?
You mention ambiguous results. What do you mean? Because I would assume it would produce erroneous results or no results at al if you match the user id with employee IDs.
If all of the above does not work, your question might me unsolvable...
From your description, the only option is to start with the time entry column, the mergejoin the ticket table on the ticket I'd and the join the employee table on the employee id.
This will get you the name of the original employee assigned to the ticket.
I am not sure they is what you.
If you need further help give an example of your date and of your expected results.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
69 | |
69 | |
24 | |
18 | |
13 |