cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nikola_bgd
Advocate II
Advocate II

Items from last 3 months

Hi, 

 

I'm trying to get SharePoint list items from the last 3 months from a column called DueDate. I'm trying with this formula in the filter query, but it's not working.. (items are not from last 3 months).

 

DueDate ge '@{formatDateTime(startOfMonth(getPastTime(3,'Month')),'MM-dd-yyyy')}' and DueDate lt '@{formatDateTime(startOfMonth(utcNow()),'MM-dd-yyyy')}'

 

Any ideas anyone?

1 ACCEPTED SOLUTION

Accepted Solutions
Rhiassuring
Super User
Super User

Ah great! Then, the above formula should work for you. I used it in the Filter Query field of my Get Items action - you'd just replace ReviewDate with DueDate. Let me know how it goes.

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



View solution in original post

4 REPLIES 4
Rhiassuring
Super User
Super User

Hi there, 


Just to be super clear: are you looking for the last 90 days, or the last 3 months - and does that "last 3 months" include this month? (This month, last month, the month before, in full?) 

I tried out this formula, and it brought back the dates of January 1st to April 1st. 

 

ReviewDate ge '@{startOfMonth(getPastTime(3,'Month'))}' and ReviewDate lt '@{startOfMonth(utcNow())}'


These are the dates on my list - and it only retrieved two of them - so it did it correctly:

 

Rhiassuring_0-1650080688261.png

 

Are you able to tell me - if your flow triggered on April 15th, what is the earliest date you would expect to see?

 

Cheers,

 

Rhia

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Hey, thanks for helping out! 

90 days or 3 months, basically it doesn't make a lot of difference, any of the two would be good. 

Last 3 months include this month.

Rhiassuring
Super User
Super User

Ah great! Then, the above formula should work for you. I used it in the Filter Query field of my Get Items action - you'd just replace ReviewDate with DueDate. Let me know how it goes.

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



This works 🙂 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (3,322)