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 / Finding Last Value in ...
Power Apps
Answered

Finding Last Value in Sharepoint

(0) ShareShare
ReportReport
Posted on by

Hello,

I'm trying to pull the last instance of a value by Sharepoint ID.  I'm using a text input with the following formula to pull the ID:

 

LookUp('Change Log',And(RequestID=ReqID.Text, New_Value="Pending Approval"),ID)

 

In the test data I'm using, this provides me with ID 619, which is the lower of the two rows with this value.  ID 622 is the other. 

 

When I attempt to add a "Last" function to the formula, I get errors that it's expecting a text value.  The syntax I'm trying to use is:

 

Last(LookUp('Change Log',And(RequestID=ReqID.Text, New_Value="Pending Approval"),ID))

 

Any advice on this?

 

cborde3_0-1701107620316.png

 

Categories:
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @cborde3,

     

    LookUp will fetch the first record that matches the condition. You could Sort() your list based on the Created column descendingly and then use the LookUp function:

     

    LookUp(
     Sort('Change Log', Created, SortOrder.Descending),
     RequestID = ReqID.Text && New_Value = "Pending Approval"
     ,ID
    )

     

     

    Alternatively, you could fetch all corresponding records via a Filter function and select the last ID from the returned output:

    Last(
     Filter(
     'Change Log',
     RequestID = ReqID.Text && New_Value = "Pending Approval"
     ).ID
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • CU06081315-1 Profile Picture
    on at

    The first solution did the job, thank you!

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 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard