cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewDev
Frequent Visitor

SP lists tied by lookup - how to create a collection made up by one list and another column from the related list ?

I've written the following code that filters signups for the current user (SignupsList is the SP list)

Set(CurrentUser, User().FullName);

ClearCollect(
    Signups,
    Filter(
        SignupsList,
        Attendee.DisplayName = CurrentUser
    )
);

 

 

 

 

And now I'd need to add a column with the session name from the other SP list (SessionsList)

ClearCollect(
   mergedList, 
   AddColumns(
      Signups,
      "SessionName",
      LookUp(SessionsList.ID = Signups.SessionID).Name
   )
)

 

 

 

 

I'm not sure how to express the join condition (SessionsList,ID = Signups.SessionID). Unfortunately the ID column is present in both SP list and collection so I'd need to disambiguate it but I'm not sure how I can achieve it.

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @NewDev ,

I would do this

Set(CurrentUser, User().FullName);
ClearCollect(
   Signups,
   RenameColumns(
      Filter(
          SignupsList,
          Attendee.DisplayName = CurrentUser
      ),
      "ID",
      "ID1"
   )
)

Then this

ClearCollect(
   mergedList, 
   AddColumns(
      Signups,
      "SessionName",
      LookUp(
         SessionsList,
         ID = ID1
      ).Name
   )
)

OR

ClearCollect(
   mergedList, 
   AddColumns(
      Signups,
      "SessionName",
      LookUp(
         SessionsList,
         ID = ID1,
         Name
      )
   )
)

 

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.

Hi @NewDev ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

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.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,903)