Forum Discussion

check1's avatar
check1
Frequent Visitor
2 years ago
Solved

Field from one table not directly related to another table

I have 3 tables - Employee, Tickets, TimeEntry.   Relationships are: Employee to Tickets - One to Many on EmployeeID field Tickets to TimeEntry - One to Many on TicketID The Employee and Ticke...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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