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

Filter gallery by an item, then show all items from today back to a date selected in date picker

Hi all,

 

I am trying to setup a gallery that filters items based on a dropdown for Job Status (Complete or Not). This part I have done.

Now what I would like to add, is a datepicker so that I can select say Monday's date, and the gallery then displays all items from Monday through to today (based on the 'job status' dropdown selection).

Alternatively, if I could filter the gallery as per above but automatically selects the start of week date (so always Monday)....

 

The date field (completed time) is a time and date field.

 

Thanks for any help

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

No problems @BrendanZ1 

Try this - dates in the past will have a minus value so

Filter(
   YourDataSource,
   JobStatus = YourDropDownName.Selected.Value &&
   DateDiff(
      YourDatePickerName.SelectedDate
      CompletedTime,
   )>=0
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

10 REPLIES 10
Highlighted
Community Champion
Community Champion

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

Hi @BrendanZ1 ,

Your gallery filter would be  (note field names need to be yours )

Filter(
   YourDataSource,
   JobStatus = YourDropDownName.Selected.Value &&
   CompletedTime = YourDatePickerName.SelectedDate
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Highlighted
Helper IV
Helper IV

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

I seem to be getting an error: 

powerapps.png

Highlighted
Community Champion
Community Champion

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

Hi @BrendanZ1 ,

The code I gave you was to filter a gallery in PowerApps (which is what you asked) - are you using this in a Flow?

Highlighted
Helper IV
Helper IV

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

Hi @WarrenBelz ,

 

I am using data from a sharepoint list for the gallery in Powerapps. The data within the list is connected to Microsoft planner with a flow so that when an item is added to the list, it adds it into planner. The flow also updates any changes as well and when someone marks the task as complete in Planner, this is sent back to the list.

I didn't create any of the flows or the list. I am trying to create an app that uses the data within the list to make the data easier to view etc.

 

So not sure if because of how the data is generated in the list, it will effect how powerapps can use it?

Highlighted
Community Champion
Community Champion

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

Hi @BrendanZ1 ,

The code I gave will filter a gallery - not being able to see your Flow (and I do not use any for purposes similar to yours), I cannot give an informed comment of the effectiveness of using the Flow code you provided. Is there any reason you are simply filtering the gallery?

Highlighted
Helper IV
Helper IV

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

@WarrenBelz  The list and its purpose initially was created by someone else including all the flows etc behind it. At the moment each entry indicates a volume of stock to be processed, or has been processed (along with other meta data). I was looking to use two galleries:

 

The first gallery is filtered with all tasks set to incomplete, so as to determine the volume still to be processed

The second gallery is filtered to tasks set to complete, so as to determine (once a date range is established), how much volume had been processed so far for the week.

 

Then set up a few inputs and use them to calculate overall volumes of the items displayed in the galleries once filtered etc.

Highlighted
Community Champion
Community Champion

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

OK @BrendanZ1
I need to make an adjustment to the original code, but the following will filter the second gallery if put in the Items property.

Filter(
   YourDataSource,
   JobStatus = YourDropDownName.Selected.Value &&
   DateDiff(
      CompletedTime,
      YourDatePickerName.SelectedDate
   )=0
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Highlighted
Helper IV
Helper IV

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

@WarrenBelz that is working and I can see why it wasn't working (but I couldn't explain it for the life of me).

The only thing is, it will only show tasks for the date selected, whereas I am wanting to grab all completed tasks from Monday to the current date.

Sorry if I hadn't explained that properly in the first instance - is there something that can be tweaked to allow this?

Thanks heaps for the help so far too.

Highlighted
Community Champion
Community Champion

Re: Filter gallery by an item, then show all items from today back to a date selected in date picker

No problems @BrendanZ1 

Try this - dates in the past will have a minus value so

Filter(
   YourDataSource,
   JobStatus = YourDropDownName.Selected.Value &&
   DateDiff(
      YourDatePickerName.SelectedDate
      CompletedTime,
   )>=0
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (7,253)