cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomasG
Advocate I
Advocate I

How to retrieve items, depend on latest date?

Hello, 

I have SP list with items, which represent covid test employee.
Example: 
employee A - 20.3.2021
employee B - 28.3.2021
employee A - 17.03.2021

And I make app, where I need to retrieve only the latest test of employee. 
Result should be:
employee A - 20.3.2021
employee B - 28.3.2021

But, I dont know, how to filter it. Or if use power automate/ logic apps to get required items?
Is in power apps some function for it, or another way to get it?

Thanks for any advice. 


1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @TomasG,

Based on the issue that you mentioned, do you want to filter out the latest test for each employee?

Could you please share a bit more about the scenario,is this date a Date and Time column?

I think GroupBy() function could achieve your needs.

I just assume that you have a Date and Time column.

Where do you want to filter out the records, Gallery?

Add a Gallery and set the Items:

GroupBy(SPLits,"employee","Gemp")

Set the Text of the Label within as below:

First(Sort(ThisItem.Gemp,Date,Descending)).Date

v-qiaqi-msft_0-1617959630838.png

Regards,

Qi

 

Best Regards,
Qi

View solution in original post

3 REPLIES 3
Drrickryp
Super User
Super User

@TomasG 

All SharePoint lists have a hidden ID column that is sequential.  To see the latest items, you can do this as the Items property of a gallery or datatable.  This function is delegatable, meaning it will work no matter how many items are in your list. 

 

Sort(Yourlist,ID,Descending)

 

 

FarrellDrafting
Helper II
Helper II

https://powerusers.microsoft.com/t5/Building-Power-Apps/Power-Apps-Select-Max-Row-for-Each-Group/m-p...

 

here is a forum post describing something similar I used to find the most recent record.

v-qiaqi-msft
Community Support
Community Support

Hi @TomasG,

Based on the issue that you mentioned, do you want to filter out the latest test for each employee?

Could you please share a bit more about the scenario,is this date a Date and Time column?

I think GroupBy() function could achieve your needs.

I just assume that you have a Date and Time column.

Where do you want to filter out the records, Gallery?

Add a Gallery and set the Items:

GroupBy(SPLits,"employee","Gemp")

Set the Text of the Label within as below:

First(Sort(ThisItem.Gemp,Date,Descending)).Date

v-qiaqi-msft_0-1617959630838.png

Regards,

Qi

 

Best Regards,
Qi

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 (1,173)