web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / using a year drop down...
Power Apps
Answered

using a year drop down to filter a date

(0) ShareShare
ReportReport
Posted on by 121

Is it possible to have a drop down box with the year 2021, 2022, 2023 etc where when the user selects the relevant year and the gallery will filter between a set date i'e 01/01/2023 - 31-12-2023 automatically?

 

 

Categories:
I have the same question (0)
  • Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @Markswan20 

     

    Try this,

     

    Filter(
     YourDataSource,
     Year(YourDateField) = Year(DropdownYear.Selected.Value)
    )

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Verified answer
    Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @Markswan20 

     

    Try this formula, this is delegation free:

     

    With(
    {
    tt: Filter(
    AddColumns(
    YourDataSource,,
    "yrs",
    Year(YourDateField)
    ),
    yrs = Year(Dropdown1.Selected.Value)
    )
    },
    tt
    )

     

     

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Markswan20,

    Have you solved your problem?

    I just add something to @Rajkumar_404

    Remember to set your year dropdown with following formula:

    ["2021", "2022", "2023" ]

    Then set your Gallery items with @Rajkumar_404 's formula.

     

    Check it and see if it works.

  • Markswan20 Profile Picture
    121 on at

    Sorry for the delay, the code none delegable works perfectly thank you, i need to SORT the data with the newest 1st "fieldname" ('Log Date') where do i need to put this within the code to achieve this?

  • Markswan20 Profile Picture
    121 on at

    I've sorted it using the following for other users

     

    With(
    {
    tt: Sort(Filter(
     AddColumns(
     LogDataALL,
     "yrs",
     Year('Log Date')
     ),
     yrs = Year(Dropdown4.Selected.Value),NewCreatedBy=varUN
     ),'Log Date',SortOrder.Descending)
     },
     tt
    )
  • Markswan20 Profile Picture
    121 on at

    However i've just stumbled on another problem, when using this code i can't navigate to the selected records as it's not recognising the gallery, i use the delegable version and it's fine, any ideas

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard