cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Becca51178
Helper II
Helper II

Need Help merging two collections

I have one list of events people can sign up for, and another list of the total people who have signed up for an event. 

 

The first collection works. It sums the total signers for an event. 

ClearCollect(TotalSignees, AddColumns(GroupBy(SignUpList, "EventName", "TotalSignees"), "NumOfSignUps", Sum(TotalSignees, EventName = EventName)));

 

The second collection does not work. It's adding a number to every item on the list regardless of the event

ClearCollect(ProjectSignUpListWithVolunteerCount, AddColumns(ProjectsEventsList_SPList, "NumOfSignUps", LookUp(TotalSignees, EventName=EventName, NumOfSignUps)));

 

All I want to do is merge the collections and if there is match insert that number into the column and if there there are no matches add a zero

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@Becca51178
Would adding some disambiguation to EventName like I’ve done below do the trick?

ClearCollect(ProjectSignUpListWithVolunteerCount, AddColumns(ProjectsEventsList_SPList, "NumOfSignUps", LookUp(TotalSignees, EventName=EventName[@ ProjectsEventsList_SPList], NumOfSignUps)));

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

View solution in original post

5 REPLIES 5
mdevaney
Super User
Super User

@Becca51178
Would adding some disambiguation to EventName like I’ve done below do the trick?

ClearCollect(ProjectSignUpListWithVolunteerCount, AddColumns(ProjectsEventsList_SPList, "NumOfSignUps", LookUp(TotalSignees, EventName=EventName[@ ProjectsEventsList_SPList], NumOfSignUps)));

—-
Please Accept as Solution if this post answered your question so others may find it more quickly.
If you found this post helpful consider giving it a Thumbs Up.
WarrenBelz
Super User
Super User

Hi @Becca51178 ,

 

You can merge two collections with the same field names by collecting them separately and then doing ClearCollect(Collection1,Collection2).

You can use RenameColumns and AddColumns to achieve this result. 
Here is a post to read on it. 

Please click and 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.

@mdevaney I am getting this error

 

PowerApps_2.1.2020 (2).PNG

@mdevaney 

Thank you!

 

This Worked

 

ClearCollect(ProjectSignUpListWithVolunteerCount, AddColumns(ProjectsEventsList_SPList, "NumOfSignUps", LookUp(TotalSignees, EventName = ProjectsEventsList_SPList[@EventName], NumOfSignUps)));

 

@Becca51178
You are right. I’ll make that small edit to the solution when I get home in an hour.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,392)