cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
manu59
Helper I
Helper I

Join two Sharepoint Lists and get max value

Hi,

 

I have 2 SharePoint Lists.

 

List n°1 contains countries :

 

countries.JPG

 

List n°2 contains travels :

 

travels.JPG

 

To join the lists, list1.ID=list2.ID_country

I need to display the countries, in a gallery, and add a column with last date of travelling for each country.

join.png

Country needs to be display even if no travels exists for this ID.

 

Have any king of ideas ?

 

Regards

 

1 REPLY 1
mdevaney
Super User
Super User

@manu59 

I suggest you create a collection but putting this code into the OnVisible property of the screen or the OnSelect property of a button.

 

ClearCollect(
    myMaxDates,
    AddColumns(
        List1,
        "Max Travel",
        LookUp(
            Sort(List2, 'Travel date', Descending),
            ID_country = List1[@ID]
            'Travel date'
        )
    )
)

 

Then you can place the collection into the Items property of a gallery or data table by simply referencing it like this

myMaxDates

 

---
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."

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (2,291)