cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rmishra
Level: Power Up

Filter based on a certain condition

I would like to filter data based on a certain condition as below:

 - get records with latest modified dates by individuals and modified on today records. Example is attached below for reference:

Left table is what I have but would like to get result as in right table.

 

Your help is appreciated, thank you in advanceCapture.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Filter based on a certain condition

@rmishra 

You can also consider using the GroupBy function to get all the associated information in that record.

AddColumns(GroupBy(SortByColumns(myData, "Date"), "Name", "entries"), "LastEntry", Last(entries))

This will give you a table that has a Name and entries column as well as a LastEntry column.

Based on your image of your data, you would have a table that has three rows and a LastEntry that has the exact data you are looking for.

If you were using this as an Items source for, let's say, a gallery, you could reference ThisItem.LastEntry.Date to get your last entry.

 

See attached sample app for more detail.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

12 REPLIES 12
rmishra
Level: Power Up

Re: Filter based on a certain condition

@RandyHayes : Any thoughts?

Super User
Super User

Re: Filter based on a certain condition

Hi @rmishra 

 

Chevck my video on how to filter date column with respect to a sharepoint list in powerapps

https://www.youtube.com/watch?v=eCMuXPI1Qok

 

similar logic can be applied for other data source

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Super User
Super User

Re: Filter based on a certain condition

@rmishra 

Take a look over @RezaDorrani 's video and see if you still have any questions.  You can definitely do what you are looking to do.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
rmishra
Level: Power Up

Re: Filter based on a certain condition

Thank you for sharing the video - but it is talks about the very basic of filtering with date. But my filtering logic is something different.

Super User
Super User

Re: Filter based on a certain condition

Hi @rmishra 

 

First sort your data source based on dates 

then use Distinct function based on name

 

this will give you the latest names with the latest date

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Super User
Super User

Re: Filter based on a certain condition

@rmishra 

You can also consider using the GroupBy function to get all the associated information in that record.

AddColumns(GroupBy(SortByColumns(myData, "Date"), "Name", "entries"), "LastEntry", Last(entries))

This will give you a table that has a Name and entries column as well as a LastEntry column.

Based on your image of your data, you would have a table that has three rows and a LastEntry that has the exact data you are looking for.

If you were using this as an Items source for, let's say, a gallery, you could reference ThisItem.LastEntry.Date to get your last entry.

 

See attached sample app for more detail.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

rmishra
Level: Power Up

Re: Filter based on a certain condition

@RandyHayes : Thank you for your inputs, but sadly unable to open the .msapp in machine - would you mind sharing me the export of it - .zip version?

 

I tried to filter as below, but failing to get one record for each individuals based on latest modified date, not sure how to get it; As I have data in excel, I need to use the DateTimeValue function. 

 

Filter(ParticipantsCollection, IsToday(DateTimeValue(CreatedDate)) = true && First(SortByColumns(ParticipantsCollection, "ModifiedDate")).EmailAddress in Distinct(ParticipantsCollection, EmailAddress))

 

This gives me only the first record.

First(SortByColumns(Filter(ParticipantsCollection, IsToday(DateTimeValue(CreatedDate)) = true),"ModifiedDate",Descending))

 

I think I need be using ForAll or something else..

Super User
Super User

Re: Filter based on a certain condition

@rmishra 

I'm not entirely sure that the the formula you mentioned is in line with the original request you had since you are trying to utilize the IsToday function. Originally you had wanted the very last entry not just those of the current day.  Clarify if you need different.

 

Anyway, please try again to open the msapp on your computer.  There is a process that perhaps you are not familiar - 

1) Download and save the file to your computer

2) Go into PowerApps studio and either Open an existing App or Create a new App - either is fine

3) Once that app opens to the designer screen, Go to File->Open.  Then choose Browse Files.  Browse to the file you saved and it will open.  

This method is much easier than exporting and trying to import into your environment.

Let me know if you stumble onto any issues.

Once in, take a look at the formulas in that app for your solution.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
rmishra
Level: Power Up

Re: Filter based on a certain condition

@RandyHayes : Sorry for not mentioning that due to some issues I do not have PowerApps studios installed in my machine to open it, and so requested yuo to export the package so that I can import and see it.

 

About my issue - I want to get the latest records based on latest modified date [I was trying some work around for performance related issues, so you could see the IsToday function]

 

Thank you again! Will wait to get your export package for reference.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 313 members 4,605 guests
Please welcome our newest community members: