cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

How to join 2 data sources

I am retrieviing a list of Direct Reports with the current user using Office365Users.DirectReports(User().Email) and saving it to a collection.

 

I also have a a SharePoint list that contains users data, "EmployeeTable".

 

Is there a way I can join sets of data? So if the user has 3 direct reports, it will show all 3 direct reports corresponding data from "EmployeeTable"

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: How to join 2 data sources

Hi @itsmeqp,

 

You need to simulate a join operation on the two tables. This can be done in multiple ways, for example via unique join keys or duplicate join keys. Are there any duplicates in your Name column? Depending on this, and whether you care about duplicates or not, try the following:

 

1. Join with duplicate Names

 

    gallery1.Items = AddColumns(Table1, "Region", LookUp(Table2, Name = Table1[@Name], Region))

 

2. Join with no duplicate Names (will produce nested data)

 

    gallery1.Items = AddColumns(

        GroupBy(Table1, "Name", "NameGroup"),

        "Group",

        AddColumns(NameGroup, "Region", LookUp(Table2, Name = NameGroup[@Name], Region)))

 

For your reference:

https://community.powerapps.com/t5/General-Discussion/Can-I-add-fields-from-multiple-data-sources-in...

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Community Support
Community Support

Re: How to join 2 data sources

Hi @itsmeqp,

 

You need to simulate a join operation on the two tables. This can be done in multiple ways, for example via unique join keys or duplicate join keys. Are there any duplicates in your Name column? Depending on this, and whether you care about duplicates or not, try the following:

 

1. Join with duplicate Names

 

    gallery1.Items = AddColumns(Table1, "Region", LookUp(Table2, Name = Table1[@Name], Region))

 

2. Join with no duplicate Names (will produce nested data)

 

    gallery1.Items = AddColumns(

        GroupBy(Table1, "Name", "NameGroup"),

        "Group",

        AddColumns(NameGroup, "Region", LookUp(Table2, Name = NameGroup[@Name], Region)))

 

For your reference:

https://community.powerapps.com/t5/General-Discussion/Can-I-add-fields-from-multiple-data-sources-in...

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Kudo Collector
Kudo Collector

Re: How to join 2 data sources

@v-monli-msft 

Is the following one working with CDS data source? I tried it on my CDS data source and it is just returning empty column.

 

1. Join with duplicate Names

 

    gallery1.Items = AddColumns(Table1, "Region", LookUp(Table2, Name = Table1[@Name], Region))

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,130)