cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anonymia25
Helper III
Helper III

Get latest entry from Sharepoint List based on a condition

Hello all,
I wanted a text label to show the latest description from the SP List which are currently based from one status, activity type and Ticket ID. My current formula works fine, but it shown the first entry for the selected Ticket ID. For example I have three rows for the current Ticket ID, but it will only shown the first/oldest one in the list.
How do I get the latest/new entry from the SP list based from the condition stated in the below formula?

 

If(LookUp(Ticket, ID = displayItem.ID).Status.Value = "Resolved", LookUp(Activity, 'Activity Type'.Value = "Resolution" && 'Ticket ID' = displayItem.ID).Description, "No resolution is available.")
 

 
Any help is greatly appreciated as always. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

I have fixed the issue for this and thanks again @Drrickryp for the clarification.
Turns out I misplaced sort function and used Created Date to display the latest order.

LookUp(Sort(Activity, Created, Descending),'Activity Type'.Value = "Resolution" && 'Ticket ID' = displayItem.ID).Description


Thanks. 

View solution in original post

3 REPLIES 3
Drrickryp
Super User
Super User

Hi @anonymia25 

Lookup will always find the first record that matches the criteria.  Since SharePoint, assigns a hidden sequential ID to every record, to obtain the latest one, sort the table by ID, Descending before applying the Lookup().  

Hi @Drrickryp ,

Thank you for the clarification, I have tried placing the sort function in my formula but it showed error. Not sure if its the correct way to place sort but I appreciate the help to guide me on this. Thanks.

If(LookUp(Ticket, ID = displayItem.ID).Status.Value = "Resolved", SortByColumns(LookUp(Activity, 'Activity Type'.Value = "Resolution" && 'Ticket ID' = displayItem.ID).Description, "No resolution is available."), Activity.'Ticket ID', Descending)

 

I have fixed the issue for this and thanks again @Drrickryp for the clarification.
Turns out I misplaced sort function and used Created Date to display the latest order.

LookUp(Sort(Activity, Created, Descending),'Activity Type'.Value = "Resolution" && 'Ticket ID' = displayItem.ID).Description


Thanks. 

View solution in original post

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!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,122)