cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lee92
Frequent Visitor

Issue with Creating Collection From Multiple Linked Entities/Table in DataVerse

Hi,

 

I have set-up the tables in DataVerse in the following structure.

 

Where the Employee Info, Positions and Departments are separate entities.

 

lee92_0-1623735797216.png

 

Now, in PowerApps, what i want to do, is based on the 3 entities above, to create a collection table of the structure below, so it can be "joined" prior to surfacing it to the users. 

 

lee92_1-1623735894227.png

 

What i've tried is the below:

 

ClearCollect(
    Merged_Employment,
    AddColumns(
        Table B,
        "Position",
        Dim_Position.'Position Title',
        Table B.cra90_surname,
        "Department IDs",
        Dim_Position.Department_ID,
        "Department Name",
        LookUp(Table C,Department_ID=Dim_Position.Department_ID,Department_Name)))

However, it's not retrieving the Department Name field from Table C correctly. 

 

Am i missing something here? Or does PowerApps not support retrieving associated records of a secondary related table into collection..Table B > Table A > Table C

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @lee92 ,

 

So you have created one to many relationships for Employee table and Department table and relate to Position table, am I right?

 

If so, the formula would be:

ClearCollect(
    Merged_Employment,
    AddColumns(
            AddColumns(
                   Table B,
                   "Position",
                   LookUp(TableA, PositionID = ThisRecord.Position_ID, 'Position Title'),
                   "Department IDs",
                   LookUp(TableA, PositionID = ThisRecord.Position_ID, Department_ID)
            ),
        "Department Name",
        LookUp(Table C,Department_ID = ThisRecord.'Department IDs',Department_Name)
    )
)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-jefferni
Community Support
Community Support

Hi @lee92 ,

 

So you have created one to many relationships for Employee table and Department table and relate to Position table, am I right?

 

If so, the formula would be:

ClearCollect(
    Merged_Employment,
    AddColumns(
            AddColumns(
                   Table B,
                   "Position",
                   LookUp(TableA, PositionID = ThisRecord.Position_ID, 'Position Title'),
                   "Department IDs",
                   LookUp(TableA, PositionID = ThisRecord.Position_ID, Department_ID)
            ),
        "Department Name",
        LookUp(Table C,Department_ID = ThisRecord.'Department IDs',Department_Name)
    )
)

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,123)