web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Joining Tables in Powe...
Power Apps
Answered

Joining Tables in Power Apps

(0) ShareShare
ReportReport
Posted on by 159

Hello Guys,

i have a problem joining two tables in PowerApps. I use SharePoint Lists as my datasources.

 

These are my tables:

Order

IDProjectDateCustomer...
1P-001-Test28.07.2020Peter 

 

OrderPosition

IDOrderIDMaterialAmountUnit
11Rubber10pcs
21Pen20pcs
31Pencil10pcs

 

Since I don't want to drag all the columns from the list "Order" into the list "OrderPosition" i've splitted the lists and would like to join both tables again in a Gallery in PowerApps using the ID from Order and OrderID from OrderPosition.

 

 

I'm stuck at the following point:

//At first I'm collection the orders for a specific project based on a filter (Dropdown)
ClearCollect(
          colProjects;
             Filter(Order;Project="P-001-Test")
);;

//After that i want to collect all the Order positions which have the same OrderID as the ID in my colProjects collection WITHOUT USING IN (can't deal with delegation here)

 

ClearCollect(
        colOrderPosition;
           AddColumns(
              Filter('OrderPosition';OrderID = colProjects.ID);
                  "Project";
                   LookUp(
                                Order;
                                ID = 'OrderPosition'[@OrderID]
)
)
);;

The formula above works if i do not the filtering but then unfortunately i get all the rows from my source OrderPosition, eventhough "Project" is blank.

What i want is to get all the orderpositions to my specific project.

 

Unfortunately there will be a lot of data in this list in a short time, so I want to filter the whole thing by Project or ID from the List Order, so that i do not push tons of data in my app...

 

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,383 Most Valuable Professional on at

    Rather than joining the lists into a single gallery I would recommend creating a parent child relationship between two galleries.

    In the parent gallery list all the records from the order list.  Then in the child gallery filter the records from the order position list to show all the records where the OrderID = gallery1.selected.ID.  As you select orders in the parent table the appropriate records for the Order Position table will show in the other gallery.

  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @KimBim 

    I looked at general example of how to JOIN two tables in Power Apps inside a collection.

    https://matthewdevaney.com/powerapps-collections-cookbook/join-all-columns-from-another-collection/


    Here's what I came up with for you.  Please let me know what the result is!

     

    //Add all columns from another table code
    ClearCollect(mySolution,
     Ungroup(
     DropColumns(
     AddColumns(
     OrderPosition,
     "myGroupedColumn",
     Filter(
     colProjects,
     ID=OrderPosition[@OrderID]
     )
     ),
     "OrderID"
     ),
     "myGroupedColumn"
     )
    );

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @KimBim :

    Firstly,let me explain why the code "Filter('OrderPosition';OrderID = colProjects.ID)" not work.

    The point is OrderID and colProjects.ID have different data types. colProjects.ID is a table.

    Secondly,please try this code:

     

    ClearCollect(
     colOrderPosition;
     AddColumns(
     Filter('OrderPosition';OrderID = First(colProjects).ID);
     "Project";
     LookUp(
     Order;
     ID = 'OrderPosition'[@OrderID]
    )
    )
    );;

     

    Or

     

    ClearCollect(
     colOrderPosition;
     AddColumns(
     Filter('OrderPosition';OrderID in colProjects.ID);
     "Project";
     LookUp(
     Order;
     ID = 'OrderPosition'[@OrderID]
    )
    )
    );;

     

    Best Regards,

    Bof

     

  • KimBim Profile Picture
    159 on at

    Hey @mdevaney Thanks for your replay. 

     

    Just fell in love with your cookbook. Man, that's awesome.

     

    Unfortunately I still get the error message that certain columns are already in the datasource. For example "Created" or "Created by".
    If I modify the query so that I only query the columns that are NOT in both data sources, it works.

     

    So I think for now I can work with it very well.

     

    Thanks a lot! 🙂

  • KimBim Profile Picture
    159 on at

    Hey @Pstork1,

    thanks for your reply. I think i can use your solution also in my app. So it might be a combination between yours an @mdevaney.

     

    Thank you guys 🙂

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard