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

 

View solution in original post

3 REPLIES 3
Drrickryp
Super User II
Super User II

@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

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (19,886)