cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SLCLARKE
Helper II
Helper II

Flow to move expired items which are older then a year

At the moment when the expiry date pasts the todays date the status chnages from Due to Expired - this all works.

 

I am trying to set up a flow, so that when expired items are older then a year the status becomes Archived.

 

I just cant get it to work?

 

I have used the following:

 

The column of the date is called ExpiryDate

 

addDays(items('Apply_to_each')?['ExpiryDate'],365)

 

formatDateTime(utcNow(),'yyyy-MM-dd')

 

SLCLARKE_0-1652871718140.png

 

 

 

3 REPLIES 3
tom_riha
Super User
Super User

Hello @SLCLARKE ,

instead of using 'Get items' to get all items and then loop through them and evaluate them one by one, you could filter them right away in the 'Get items'. That way it'll return only the items that fit the condition and you can process them directly in the loop without the condition.

The Filter Query in 'Get items' might look like below:

ExpiryDate lt '@{getPastTime(1,'Year')}'


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Thank you for your help. I just have the following error:

 

SLCLARKE_1-1652949832469.png

 

Hello @SLCLARKE ,

as the error tells you, you can't use calculated column in the 'Filter Query'. You must move the calculation from the column directly into the flow as explained here and base it on the date column that you use as the source for the calculated one.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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
Top Kudoed Authors
Users online (1,333)