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 / Trying to add a column...
Power Apps
Answered

Trying to add a column to a collection

(0) ShareShare
ReportReport
Posted on by 380

I have the following code which creates a collection from a Sharepoint list called TripDetails - it filters on the date being Today and 5 days into the future - this working fine:

ClearCollect(
 colTripData,
 With(
 {
 StartDate: Today(),
 EndDate: Today() + 5
 },
 Filter(
 TripDetails,
 tripdate >= StartDate,
 tripdate < EndDate
 )
 )
);

I need to get the region field into that collection but it is in a different Sharepoint list called Trips so I need to do an AddColumns with a LookUp on tripid which is in both lists and then return the region field - I think the code is similar to this :

AddColumns(
 Trips,
 "Region",
 LookUp(
 colTripData,
 tripid exactin Trips.tripid
 ).region
)

- can someone tell me how I wrap that code around my existing ClearCollect please - I have tried many combinations but none have worked for me yet...thanks

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    156,064 Most Valuable Professional on at

    Hi @bobgodin ,\

    You can put the AddColumns at the bottom too if you want - neither place is Delegable. I also assumed the field name in your other list.

    With(
     {
     StartDate: Today(),
     EndDate: Today() + 5,
     Data:
     AddColumns(
     TripDetails,
     "Region",
     LookUp(
     Trips As aTrip,
     aTrip.tripid = tripid
     ).Region
     ) 
     },
     Filter(
     Data,
     tripdate >= StartDate,
     tripdate < EndDate
     )
    );

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • bobgodin Profile Picture
    380 on at

    hi @WarrenBelz thank you that did the trick!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 366 Most Valuable Professional

#2
11manish Profile Picture

11manish 184

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 99 Super User 2026 Season 1

Last 30 days Overall leaderboard