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 / Update Last Added Dupl...
Power Apps
Answered

Update Last Added Duplicate Item in SharePoint List

(0) ShareShare
ReportReport
Posted on by 23

Hey, everyone! 

I'm new to Power Apps and apparently filtering and I aren't friends because I'm having a tough time with it. 

 

Basically, I'm trying to update an item in a SharePoint list based on the column 'Username'. Right now, I'm using the Patch function to update the list item based on that username. However, the problem is that, in the event that there's a duplicate username, I need to update the last added item with that username. 

 

I know that using SortByColumns(Filter('SharePoint List Title', Username = username_variable), "Created", Descending) would get me the last added item in the list where Username is equal to username_variable, but I don't know how to integrate that into my Patch function, which currently is very basic: Patch('SharePoint List Title', Lookup('SharePoint List Title', Username = username_Variable)

 

If anyone could help me combine those two statements so that only the last-added item in the list with that username is being updated, I would be eternally grateful. 

Categories:
  • AnthonyD Profile Picture
    559 on at

    Please try,

     

    Patch('sharepoint list',SortByColumns(Filter('SharePoint List Title', Username = username_variable), "Created", Descending), {<your patch code>})

  • Verified answer
    AnthonyD Profile Picture
    559 on at

    If that does not work please consider doing this,

     

    Set(varRecord, First(SortByColumns(Filter('SharePoint List Title', Username = username_variable), "Created", Descending))

     

    Then use varRecord for your patch,

     

    Patch('sharepoint list',varRecord,{<your patch code>})

  • gmmistur Profile Picture
    23 on at

    Thank you, Anthony!

     

    The second solution was the one that worked for my app. I appreciate you and all of your help! 

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard