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

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
Advocate II
Advocate 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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (3,283)