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

Gallery to filter by month

i have a app where gallery needs to filter depending upon the selection in the dropdowns and also need to filter by month. If the current month is July i need the gallery to filter and show the last month data's.

         Example:  if Dropdown1. Selected. Result= aa  then gallery need to filter the name of the Employees "aa" and Month would be the current month-1  to get the Last month. if current month is august i need a july month data related to the Name "aa".

 

Have a DataSource ": Employees

                        ex.png

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ganesan_gowri ,

Do you want to filter your Gallery records based on the selected Dropdown option and respective month (current month -1)?

Do you want to display all available records in your Gallery when you do not select any option within the Dropdown box?

 

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please try the following formula (set the Items property of the Gallery to following) :

Filter(
       EmployeeCol,
       If(
           IsBlank(Dropdown2_4.Selected.Result),
           true,
           'Supplier Name' = Dropdown2_4.Selected.Result && First(Split('Disposition Month', "-")).Result = Text(DateAdd(Today(), -1, Months), "[$-en-US]mmm")
       )
)

 

Please try above solution, hope it could solve your problem.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
eka24
Super User
Super User

Insert 2 Dropdowns one for month and the other for Name. You can also use a combobox.

 

On the Items property of month dropdown1 put:

Distinct (Employee,Month)

 

On the Items property of Name dropdown2 put:

Distinct (Employee,Name)

 

Then on the Items property of the Gallery;

 

If(IsBlank (Dropdown1.Seletected.Result) Or

IsBlank (Dropdown2.Seletected.Result),

Employee,

Filter (Employee, Name=Dropdown2.Selected.Result Or Month=Dropdown1.Selected.Result ))

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

screen.png

No i dont want Dropdowns for Month. I used Dropdowns to list out the names . i need the gallery to update everytime depending on the current month.

So for now we are in July month so i need a gallery to filter the previous month data of June all the time without dropdown selection.

If i use the App in August i need the gallery to filter the July month data.

 

Logic is to filter the gallery without using specific dropdown for months.

it needs to calculate the current month then to subtract the current month-1 to get last month.

In that case use one dropdown for the Name and filter as;

 

If(IsBlank (Dropdown1.Seletected.Result),

Employee,

Filter (Employee, Name=Dropdown2.Selected.Result && Month= Text( DateAdd( Today(), -1, Months ),
"mm-yy")))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

i use the same way that you mentioned but its shows incompatible errors and  depending on the dropdown values gallery is not filter the  previous month records. 

 

If(IsBlank (Dropdown1.Selected.Result),

Employee,

Filter (Employee, Name=Dropdown1.Selected.Result && Month = Text( DateAdd( Today(), -1, Months ),
"mm-yy")))

------------

Error:

month.png

 

 

 

Please show the full picture of the formula error, the complete formula with the errors

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

GarethPrisk
Resident Rockstar
Resident Rockstar

My guess is that the Month column is in fact a date column, with custom formatting.

 

@eka24 has good solution, but it just needs to be adjusted so the evaluation of the column is against a compatible data type (i.e. date). However, it's hard to know the format of the actual values in the column. 7/1/2020 and 7/2/2020 would both show as "7/20" with that formatting.

 

If delegation is not a concern, you could filter the dataset with an added column. Something like:

 

Filter (

AddColumns(srcExcel, "appMonthDiff", DateDiff( Today(), dateColumnExcel, Months ) )

, appMonthDiff = -1

)

Excel DataSource: EmployeeCol

exact3.png

 

My Screen:

I have onlyone dropdowns for "' Supplier Name""

*****I dont need dropdown for months and aslo i didnot add a month column in the Gallery.*****

Logic is ------> Gallery needs to filter depending on the values of the dropdowns with the respective month.  Month wants to be always the previous month by calculating the current month. So i need previous month data's for all the columns mentioned in the Gallery. Current month-1 ie: August-1= July. So every time when i come in to the App and click the dropdowns it want to  filter the gallery with dropdowns selected value and the datas should display the (Current month-1 ie: August-1= July) datas.

 

exact1.png

Hi @ganesan_gowri ,

Do you want to filter your Gallery records based on the selected Dropdown option and respective month (current month -1)?

Do you want to display all available records in your Gallery when you do not select any option within the Dropdown box?

 

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, please try the following formula (set the Items property of the Gallery to following) :

Filter(
       EmployeeCol,
       If(
           IsBlank(Dropdown2_4.Selected.Result),
           true,
           'Supplier Name' = Dropdown2_4.Selected.Result && First(Split('Disposition Month', "-")).Result = Text(DateAdd(Today(), -1, Months), "[$-en-US]mmm")
       )
)

 

Please try above solution, hope it could solve your problem.

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,956)