How to apply Multiple Filters to Power Apps Gallery: Dates, Ranges & More! - ID Card Make

How to apply Multiple Filters to Power Apps Gallery: Dates, Ranges & More! - ID Card Make Hello everyone Raza here in this video I will show you how to create multiple filters for galleries in powerapps we will focus on filtering based on dates date ranges set default values for.

How to apply Multiple Filters to Power Apps Gallery: Dates, Ranges & More!

Filters and also combine it with other filters and all of these using simple formulas in powerfx so let's check it out in action .

I have a power app wherein I have a gallery that is connected to a very simple SharePoint list this list tracks sales discount requests I have the customer names the products.

For which they are requesting a discount the discount percent and the date address this discount is effective now effective date is a key metadata.

That I would like to provide filters on which allows the user to refine the results in the gallery based upon the date range selected currently the gallery is showcasing all.

The data if I was to pick a start date let's say the 1st of August the gallery will filter the data to show all the items where the effective date.

Is from the 1st of August onwards if I also provide an end date to this let's say 15th of August the gallery gets filtered to list out the items where the effective date is in.

This date range if I reset Gallery showcases all the data from my list if I simply pick the end date 1st of.

August the gallery now showcases all the data where the effective date is first of August or anything less than that and in case I pick a start date that is.

Greater than the end date I receive an error that start date cannot be greater than and date along with the date range filters I can also add other filters to my.

Gallery for example the product so let's build this from scratch I am in the studio experience for the PowerApp I have a gallery.

The items property is connected to my SharePoint list that is connected in my power app that's my sales discount requests list I will be using the modern controls in.

Posts Related:

    Powerapps - ID Card Make

    To allow the user to filter the data in the gallery so I'll add a couple of text controls I have named the text as start date and.

    End date and I will add a couple of date picker controls for the start date control I will rename it to DP start date.

    And for the end date control I will rename it to DP and date following good naming standards now to apply that filter logic for the items property of the gallery.

    I will use the filter function to filter my list I'll use the and function.

    My date column in SharePoint is called effective date so effective date should be greater than or equal to the date picker control DP start date.

    Dot value I'll put a comma my second condition for and function will be effective date is less than or equal to.

    DP end date dot value I'll close the and condition I'll close the filter condition I'll click format text now this formula assumes that we will.

    Always have values for start date and end date which may or may not be the case so to handle scenarios where they could be blank.

    For the first condition I will use an or function and here I will use the function is blank to check.

    The date picker DP start date has a

    Value comma the actual condition itself and I'll close the or function.

    And I will do something very similar for effective date less than or equal to the end date or is blank DP end date.

    Dot value comma that's the second expression now I'll click format text and that completes my formula.

    Let's preview the app let's pick a start date August 10th the gallery shows all the data from August 10th onwards.

    Now let's pick an end date of August 18th now the gallery will show me the data based on that date range now I would like to reset these filters.

    And test other scenarios so for that I will insert a button text for the bottom I'll call it reset and on select of this button.

    I will use the reset function to reset DP start date and reset DB and date those are my two date picker controls let's preview the app.

    Click reset the date picker controls are reset to blank the gallery shows all the data now let's pick an end date.

    I'll pick the end date as July 25th so this should show me all the items that have an effective date until July 25th and if I click reset the gallery shows.

    All the data we can also provide certain default values for example the date picker control for start date.

    Its value property is blank I will set this to today so now it's showing all the items where the effective date is today or greater and if I want to box this in a specific.

    Date range I can do that August 16th and this time if I click reset start date will always hold that default value which is today's date.

    If you want to give a default value for the end date as well let's try that for the value property of this date picker.

    For a date range of one month I will use the function date add today's date let's add one month.

    And you can Define this unit in days months quarters in this scenario I'll pick one month if I preview notice it begins with the date range for.

    One month I can change this let's say start from 4th of July up until the 3rd of September and if I click reset.

    If you want scenarios where you want to force the date range to always be a month so end date add.

    Instead of today I will say DP start date dot value and if you don't want the user to change the end date it should purely be dependent upon the start date.

    For the display mode property I will change the display mode of this control to disabled so we can see that I cannot change the end date but as I change the start date.

    Let's say August 16th this will give me a one month range and if the start date itself has a value empty the end date will also be empty so at that point it will show me all the.

    Items I've changed the display mode of the end date back to edit if you want to add other filters for your gallery.

    And you wanted to work along with the date filters so let's add one for product Now product in my SharePoint list is a choice column when the following three.

    Choices so here I will use a drop down control I will rename this drop down control to DRP product for the items property.

    I will use the function choices my SharePoint list Dot my column product which will list out all the choice.

    Values and for the modern drop down control there is a property called fields I will edit add field.

    And pick value so now if I preview the app product will list out all the choices from my product Choice column so the user can select any product.

    The reset button I will add one more reset action here to reset my product drop down.

    So if the user clicks reset product gets reset to empty and to add this filter to my gallery in the and function once again I'll use or.

    Similar technique is blank DRP product Dot selected dot value comma.

    DISCLAIMER: In this description contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission. This helps support the channel and allows us to continuetomake videos like this. All Content Responsibility lies with the Channel Producer. For Download, see The Author's channel. The content of this Post was transcribed from the Channel: https://www.youtube.com/watch?v=1QflzfPyPe0
Previous Post Next Post