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 / AddCollumn Join Collec...
Power Apps
Answered

AddCollumn Join Collections or Merge -to Create new collection

(0) ShareShare
ReportReport
Posted on by 638

Esteemed Colleagues,

 

Not sure if I'm over thinking, or simply lost.

Working with (2) Collections

  • colQueryTest
  • colQueryTest2

 

 

 

ClearCollect(colQueryTest,
 	Table(
 	{ Flavor: "Strawberry", UnitPrice: 1, QuantitySold: 20 }, 
 	{ Flavor: "Chocolate", UnitPrice: 3, QuantitySold: 45 },
 	{ Flavor: "Vanilla", UnitPrice: 5, QuantitySold: 35 }
 	)
 );
 ClearCollect( colQueryTest2, 
 	Table(
 	{ Flavor: "Strawberry", size: 3, Style: "original" }, 
 	{ Flavor: "Chocolate", size: 6, Style: "original" },
 	{ Flavor: "Vanilla", size: 9, Style: "mixed" }
 	)
 )

 

 

  1. End goal is to create a New Collection "colQueryTest3
  2. merging all data based on the 'Flavor' field.

So for example result in colQueryTest3;

 

 

{ Flavor: "Chocolate", UnitPrice: 3, QuantitySold: 45, size: 6, Style: "original" }

 

 

 

Been bumping my head on the wall using AddColumns, Groupby, Collect and just not gaining any traction so far.

 

Also for what its worth,
I'm using simple collections to test out formulas but the end goal would be to use SharePoint Lists as the sources.

 

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @chico 

    Please try the following,

    ClearCollect(colQueryTest3,
     AddColumns(colQueryTest2, 
     "UnitPrice", LookUp(colQueryTest As tempCol, Flavor=tempCol.Flavor).UnitPrice,
     "QuantitySold", LookUp(colQueryTest As tempCol, Flavor=tempCol.Flavor).QuantitySold
     )
    )

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • chico Profile Picture
    638 on at

    @CNT ,

     

    that formula def works and I appreciate the assist.

    Can you give me some insight in to what is happening here;

    LookUp(colQueryTest As tempCol

    my first time seeing the "As" and is it safe to assume its simply storing in a very temp collection that is instantly recollected in the next line?

     

    Also, I've seen challenges in the past when doing a Lookup on SharePoint lists with more than 1k records,

    could this same process be accomplished with using Filter, instead of Lookup?

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @chico 

    LookUp  is used to find the matching record with the same key (Flavour in this case). LookUp returns the first matching record whereas Filter returns all the matching records. 

    We are using the As operator to avoid ambiguity of the Column Names.

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • chico Profile Picture
    638 on at

    oki, thank you.

    appreciate the insight and support

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @chico 

    Glad to help!

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
11manish Profile Picture

11manish 541

#2
WarrenBelz Profile Picture

WarrenBelz 434 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 289

Last 30 days Overall leaderboard