Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Filter Gallery based on blank Dropdown Month and Year

(0) ShareShare
ReportReport
Posted on by 40

Hi All,

 

I have 2 dropdown called DrMonth and DrYear and Items for both each dropdown as shown below

 

DrMonth

Items = Sequence(12,1,1)

DrYear

Items = Sequence(12,Year(Now()) - 0,1)

 

Now, I have Sharepoint list column called 'Induction Date' and type is Date & Time.

I have filter my gallery with below code which is working as I expected and I can retrieved the records based on Month or Year I have selected.

but now,  I need to achieved default both dropdown are blank and on Gallery will retrieved all records from SharePoint list.

 

Code

Sort(
 Filter(
 'IT Induction SEA',
 'Induction Date' >= Date(
 DrYear.Selected.Value,
 DrMonth.Selected.Value,
 1
 ) And 'Induction Date' < DateAdd(
 Date(
 DrYear.Selected.Value,
 DrMonth.Selected.Value,
 1
 ),
 1,
 Months
 )
 ),
 'Induction Date',
 Descending
)

 

Thanks 

Categories:
  • Am4ree Profile Picture
    Am4ree 40 on at
    Re: Filter Gallery based on blank Dropdown Month and Year

    Hi @Ethan_R ,

     

    Thank you for your respond.

     

    Have tried your code, however the default drmonth is 1 and dryear is 2023 due i put items Sequence(12,1,1) on drmonth and Sequence(12,Year(Now()) - 0,1) for dryear. when the screen gallery showing all records from month 1 and 2023 year retrieved, what I need to modify on item drmonth and dryear to get blank value?

     

    Thanks

     

    What items i need to be add on drmonth and dryear?

     

     

  • Ethan_009 Profile Picture
    Ethan_009 4,836 on at
    Re: Filter Gallery based on blank Dropdown Month and Year

    Hi @Am4ree ,

     

    Try the following code,

    Sort(
     Filter(
     'IT Induction SEA',
     ( IsBlank(DrYear.Selected) || IsEmpty(DrYear.SelectedItems) || 'Induction Date' >= Date(
     DrYear.Selected.Value,
     DrMonth.Selected.Value,
     1
     )) And 
     ( IsBlank(DrYear.Selected) || IsEmpty(DrYear.SelectedItems) || 'Induction Date' < DateAdd(
     Date(
     DrYear.Selected.Value,
     DrMonth.Selected.Value,
     1
     ),
     1,
     Months
     ))
     ),
     'Induction Date',
     Descending
    )

     

    Hope this helps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard