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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / SharePoint list Get It...
Power Automate
Unanswered

SharePoint list Get Items filter for current year

(2) ShareShare
ReportReport
Posted on by 105

I'm trying to figure out how I can filter the items my Get Items to only pull the items that are in the current year. Some of my items have a "future" date (2022)

 

The flow is a scheduled flow to run weekly. I  first created a variable (named current year) to format the current date (utc) to only show the year 'yyyy'. Each of the SharePoint items has a date field ( named Due Date)formatted mm/dd/yyyy. I want the get items action to only pull the items that match my 'yyyy' variable.  I tried  Due Date eq 'current year' and also tried Due Date contains 'current year'. Both get an error message.

 

Thank you in advance for your help

Categories:
I have the same question (0)
  • eliotcole Profile Picture
    4,363 Moderator on at

    Are you talking about a filter action? Or are you talking about the ODATA filters on the Get items action?

     

    Often times there's a way to get exactly what you want here.

     

    I haven't tried this, but am about to:

     

    yearField ge '2021-01-01' and yearField lt '2021-01-01'

    Using less than the first to avoid month/date nonsense.

     

  • Earl20 Profile Picture
    105 on at

    I'm referring to the ODDATA filter. I'm a newbie in power automate, r.  I don't want to manually type the current year  in a  condition action then have Due Date equal it, because then every year I have to remember to go in a change the current year after 12/31

  • Verified answer
    eliotcole Profile Picture
    4,363 Moderator on at

    No, absolutely, I just wasn't aware that you needed the logic to get the years all set up, too. I was giving you the barebones to ensure that the actual query worked.

     

    All you need to do is present the ODATA filter with the dates that you wish to be greater than or equal to in the first instance, and less than in the second. In the date format that your systems are setup for.

     

    So either use an expression to generate the dates in the ODATA field, or have a variable/compose show them.

     

    This works for the greater than or equals expression which you can either place in the field, or work it out as a string value in a Variable or a Compose:

     

     

    concat(utcNow('yyyy'),'-01-01')

     

     

    Here's the less than:

     

     

    concat(add(int(utcNow('yyyy')), 1), '-01-01')

     

     

     

    Here's how I've used it in my example flow where my date field (which also has time values in the actual list) is called "dateOfDeparture":

    simple dates filter.jpg

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard