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 / Show distinct and late...
Power Apps
Answered

Show distinct and latest records in a PowerApps Gallery and open selected record in Edit Form

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Everyone!

I have a SharePoint list with repeating entries for the same 'Project Name'.  I want to show in a Gallery with the latest record for each distinct 'Project Name' .

And want to edit selected record from gallery into edit form.

Currently I have applied the logic from one of the blog (attached the snap). It shows me desired output in gallery. But when I am trying to open any record from gallery to edit form, it fails.

 

Really appreciate your help. Thank you!!!

 

code.PNG
Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,730 Most Valuable Professional on at

    Hi @Anonymous ,

    It helps greatly to post your code in Text - I have done this below (OCRd so watch spelling)

    Sort(
     RenameColumns(
     AddColumns(
     GroupBy(
     Sort(
     'Project Portfolio List', 
     ID,
     Descending
     ),
     "ProjectID",
     "OtherData"
     ),
     "Project Name",
     First(OtherData).'Project Name', 
     "Country",
     First(OtherData).Country, 
     "Function",
     First(OtherData).Function,
     "Methodology",
     First(OtherData).Methodology, 
     "CreationYear",
     First(OtherData).CreationYear, 
     "ID",
     First(OtherData).ID
     ),
     "ProjectID",
     "Project ID"
     ),
     'Project ID',
     Descending
    )

    You can also do it this way (Note you have the same Delegation limitations as above and need all the records to be in the newest xxx (Delegation limit) records and get all the fields available

    With(
     {
     wList:
     Sort(
     'Project Portfolio List', 
     ID,
     Descending
     )
     },
     With(
     {
     wGroup:
     AddColumns(
     GroupBy(
     wList,
     "ProjectName",
     "Data"
     ),
     "gID",
     First(Data).ID
     )
     },
     Sort(
     Filter(
     wList,
     ID in wGroup.gID
     ),
     'Project ID',
     Descending
     )
     )
    )

    but to your question - the Item of the Form can simply be

    LookUp(
     'Project Portfolio List',
     ID = GalleryName.Selected.ID
    )

     

    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.

    Visit my blog Practical Power Apps

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you so much. It works.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    If possible, can we connect to better understand the code and other tricks regarding PowerApps.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard