Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

using a year drop down to filter a date

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:
  • Markswan20 Profile Picture
    Markswan20 121 on at
    Re: using a year drop down to filter a date

    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

  • Markswan20 Profile Picture
    Markswan20 121 on at
    Re: using a year drop down to filter a date

    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
    Markswan20 121 on at
    Re: using a year drop down to filter a date

    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?

  • Verified answer
    Re: using a year drop down to filter a date

    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.

  • Verified answer
    Rajkumar_404 Profile Picture
    Rajkumar_404 6 on at
    Re: using a year drop down to filter a date

    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.

  • Rajkumar_404 Profile Picture
    Rajkumar_404 6 on at
    Re: using a year drop down to filter a date

    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.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard