Showing results for 
Search instead for 
Did you mean: 
New Member

Get Items filter by this Year Only

I am creating a test request system based in sharepoint list where I want a unique test ID that resets every year. The test ID will look something like PTL22-250, where "PTL" is a constant string, 22 (2022) is the year of the creation item in the list, and 250 is the 250th request in 2022. I currently have a solution where I grab all items from my list with the get items field, initialize a variable to find the year of the current timestamp, and do an if statement to see if the created field in my list item starts with the year variable. (Created field returns a string of the form "yyyy-mm-dd-hh-mm-ss" or something close, I know it starts with yyyy. 


This is a very long way to do it, I was wondering if there was a more robust method. I would love to be able to use the ODATA filter on get items to return only the values that start with the year variable I made, but it just won't work. Here is my error message below. Any ideas on how to make this work? I just want to return items that were created in the same year as my flow run.



Continued Contributor
Continued Contributor

Hi @GStanisic12 , 


Take the output from sharepoint without a filter query and filter it in the next step using a filter array in advance mode like this: 

Change the item()?['Date'] to the column where you have the date. So you probably only have to replace the date in ['Date'].


@equals(formatDateTime(item()?['Date'], 'yyyy'), formatDateTime(utcNow(), 'yyyy'))


Let me know how it goes 😄


{ If my post answered your question, please Accept it as a solution ✔ }
{ This will in turn help others find solutions to similar questions }

Best Regards

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,972)