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 Apps
Unanswered

Filter by year

(0) ShareShare
ReportReport
Posted on by 78

I have a dataverse column called 'Created on' in table called 7371_projecttracker that has a date/time value. I would like to add a drop down that has 2022, 2023 and any other year if it is in the created-on value.  I would also like the default year to be the current year. 

 

I have three galleries that I need to point the dropdown to. How do I do this? How do I display the dates if my created on column is not formatted to a year? 

 

karlamaddox1_0-1679936880578.png

 

Categories:
I have the same question (0)
  • karlamaddox1 Profile Picture
    78 on at

    @LaurensM anyway you can help me out here? tysm! 

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @karlamaddox1,

     

    Thank you for the tag.

     

    (1) Dropdown

     

    The dropdown would list all of the distinct Years present in your table. The Items property of the dropdown would look similar to:

    Distinct(
     //You might have to change the table name to the correct displayname
     projecttracker,
     Year('Created On')
    )

    Please note that Distinct() can only take the first 2000 records into account. Should your table have > 2000 records, you will need a way to prefilter the table (e.g. removing inactive tasks) or provide a manual list of years.

     

    The Default property of that dropdown will be:

    //Autoselect current year
    Year(Today())

     

    (2) Filtering the galleries

     

    You will have to filter the galleries by adding the filter() function in the Items property in order to only display records created in a certain year. Should your table have less than 2000 records, you can get away with the non-delegable first option. If this is not the case, you should opt for the second option.

     

    //OPTION 1
    Filter(
     //Change table name if necessary
     projecttracker,
     Year('Created On') = Dropdown1.Selected.Value
    )
    
    //OPTION 2
    Filter(
     //Change table name if necessary
     projecttracker,
     'Created On' >= Date(Dropdown1.Selected.Value, 1,1) && 'Created On' <= DateTime(Dropdown1.Selected.Value, 12,31,23,59,59)
    )

     

    If this solves your question, would you be so kind as to accept it as a solution.

    Thanks!

  • karlamaddox1 Profile Picture
    78 on at

    Youre amazing! I think it is something in my formula that is not longer filtering my results to received. any thoughts? 

     

    SortByColumns(Filter('7371_Project Trackers', '7371_Project Trackers (Views)'.Received, Year('Created On') = Dropdown2.Selected.Value, Lead = ComboBox3.Selected.Value || ComboBox3.Selected.Value= Blank()), "cr02d_projectid", If(SortDescending1,SortOrder.Descending,SortOrder.Ascending))

     

     

    Last one for you, what if they wanted to see both 2022, and 2023 data together? 

     

    Thanks a million!!! 

  • LaurensM Profile Picture
    12,516 Moderator on at

    Hi @karlamaddox1,

     

    Your code looks fine, I would expect this to work. I tried to replicate this issue on my end with the active & inactive views, but the filtering worked smoothly. You could try to filter via the view first and then filter by the additional conditions, but this uses 2 Filter() functions and is thus less optimal:

     

    SortByColumns(
     Filter(
     //Prefilter via view
     Filter(
     '7371_Project Trackers', 
     '7371_Project Trackers (Views)'.Received
     ),
     //Apply additional filters 
     Year('Created On') = Dropdown2.Selected.Value, 
     Lead = ComboBox3.Selected.Value || ComboBox3.Selected.Value= Blank()
     ), 
     "cr02d_projectid", 
     If(
     SortDescending1,
     SortOrder.Descending,
     SortOrder.Ascending
     )
    )

     

    Additionally, since the function is not delegable you could double check the Data Row Limit in your app settings. (App Settings in the editor -> General -> Scroll down to Data Row Limit -> set this to 2000) Your complete table should also not contain more than 2000 records for the filtering to work correctly (or in the case of the 2 filters above, the view filtered output should not contain > 2000 records).

     

    Since we chose the non-delegable option, that made our life a bit easier when it comes to allowing multiple dates to be selected. You will have to swap your dropdown to a combobox in order to allow multiple selections. The code change is quite small: change Year('Created On') = Dropdown2.Selected.Value to IsBlank(ComboBox1.SelectedItems) || Year('Created On') in ComboBox1.SelectedItems

     

    I 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

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 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard