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

Filter gallery using dates

Am having difficulty figuring out the exact syntax to achieve the following:

 

In my gallery I have a label that shows a date  LblActualExpirydate  It's a calculated label with the details formatted as follows:  

 

If(IsBlank(LblExpiryDate.Text),LblCalcExpiryDate.Text,LblExpiryDate.Text) 

 

I want to filter the gallery for items where LblActualExpirydate is today +30 or less 

 

They are all labels ! so I know I need to format them as date values rather than string but struggling with that also..

Any suggestions?

 

 

 

 

 

 

 

12 REPLIES 12

Hi @vfdd ,

 

How about this:

//With this formula, you can filter the data on Gallery
Filter('Employee Details',Text(Created,"[$-en-US]dd-mm-yyyy") = DateAdd(DateValue(Label40.Text),-30,Days))

// This will convert the dates on the label to date value
DateValue(If(IsBlank(LblExpiryDate.Text),LblCalcExpiryDate.Text,LblExpiryDate.Text)) 

Now using these 2 formulas you can try one more time. In your reply, you said, "But I now want to filter the gallery based on the actual expiry date" this validation against which date??? if it is on the same date try below:

//With this formula, you can filter the data on Gallery
Filter('Employee Details',DateValue(If(IsBlank(LblExpiryDate.Text),LblCalcExpiryDate.Text,LblExpiryDate.Text)) = DateAdd(DateValue(If(IsBlank(LblExpiryDate.Text),LblCalcExpiryDate.Text,LblExpiryDate.Text)),+30,Days))

In the above, I am filtering the gallery with the expiry in the next 30 days.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

thanks @KrishnaV  I think your 2nd one might work, so doing the calculation in the filter text.  But can't quite get it.. the 2nd part of your formula above gives me red squigly lines !! have tried it a few ways.   I do think that if I can do the calculation at source as per Pstork suggestion in  sharepoint then that also would solve the issue. but again I can't get that right 😞

ok I managed to get it working at source ! which just simplified everything... thanks all 🙂

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,104)