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 Automate
Answered

Compare dates

(0) ShareShare
ReportReport
Posted on by 42 Season of Giving Solutions 2025
Good morning, I am new to flows. I have a sharepoint list with items that have a column named PM DATE. What I am trying to do is create an automated flow to compare today's date to the PM DATE column for all the items to see if todays date is 30 days or less away then send an email. I've watched quite a few videos and tried but cant seem to get the right results. So far I have:
 
Recurrence set up okay
Compose / convertTimeZone(utcNow(),'UTC','Eastern Standard Time','MM-dd-yyyy' )
Get Items- pulling in my sharepopint home address and correct list
This step is where i need help ....... every video says an APPLY TO EACH (this is where i need help)
 
I know how to send the emails in the True condition.
Categories:
I have the same question (0)
  • Suggested answer
    Tomac Profile Picture
    4,048 Moderator on at
     
    You'll want to try this structure:
     
    1. Trigger: Recurrence
    2. Action: Get Items - targeting your SP list
    3. Action: Apply To Each - running on the Value output from Get Items
      1. Action: Condition
        1. Left Side: dynamic content for PM Date from your Get Items action
        2. Middle: less than or equal to
        3. Right side: your convertTimeZone expression (no need to use a Compose earlier)
        4. If Yes: Send the email and then progress to the next list item
        5. If No: Do nothing, the flow will progress to the next list item
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at
    You can directly filter using Get Items with OData Filter:
     
    PM_DATE ge '@{formatDateTime(addDays(utcNow(), -30), 'yyyy-MM-dd')}'
     
  • CU10021407-0 Profile Picture
    42 Season of Giving Solutions 2025 on at
    @Tomac Nothing happened. 
     
  • CU10021407-0 Profile Picture
    42 Season of Giving Solutions 2025 on at
    @abm abm - i added that formula to the OData filter in the get items. do I still do a for each?
  • Verified answer
    Tomac Profile Picture
    4,048 Moderator on at
     
    Apologies - on the right side you'll need to add 30 days. Use this expression:
    convertTimeZone(addDays(utcNow(),30),'UTC','Eastern Standard Time','MM-dd-yyyy' )
    If you want to ensure you don't also get any dates in the past, add another line to the Condition with the same thing on the left side, the middle should be Is Greater Than, and the right side is just the expression utcnow() (converted to your timezone if you plan to run it within 5 hours of midnight)
     
    Going with @abm abm's suggestion you will use the Apply To Each but not the Condition. Note that the filter abm_abm provided will look for dates 30 days ago and newer. For dates within the next 30 days, you'll use this:
    PM_DATE le '@{formatDateTime(addDays(utcNow(), 30), 'yyyy-MM-dd')}' and PM_DATE ge '@{formatDateTime(utcNow(), 'yyyy-MM-dd')}'
     
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at
    Hi
     
    Thanks for your quick reply.
     
    Yes map one of the values then it will generate the Apply to each automatically. If you want to send one email with these then do not use Apply to each, instead use the Select action step. Use this result to create the HTML table action step and finally use this result into the email body. 
     
     
    Thanks
  • CU10021407-0 Profile Picture
    42 Season of Giving Solutions 2025 on at
    @ Tomac, i have everything you told me to do on your solution. I get emails for every item on the sharepoint list and those dates ae throughout the year.
     
    I have:
     
    Recurrence
    Getitems - my sharepoint and list
    Apply to Each - output is VALUE
    The top right formula is 
    convertTimeZone(addDays(utcNow(),30),'UTC','Eastern Standard Time','MM-dd-yyyy' )
     
    The bottom right formula is 
    convertTimeZone(utcNow(),'UTC','Eastern Standard Time','MM-dd-yyyy' )
     
    After I ran the test all 19 items on the list came up as false. There are actually 3 items in December with dates of 12/12, 12/19 & 12/31. I would of thought that 2 items would have come back as true.
     
     
  • David_MA Profile Picture
    14,090 Super User 2026 Season 1 on at
    Just to confirm, are you trying to find all items where the PM DATE is between today and the next 30 days (for example, from November 21 through December 21), if the PM DATE equals today, or get items where today's date plus 30 days equals the PM DATE, and then send an email for those items? The approach depends on your answer—one way will send up to 30 reminders, while the other two will only send one reminder.

    Also note that in conditions and query filters, dates need to be formatted in ISO 8601 format for them to work (yyyy-MM-ddTHH:mm:ssZ). For what you’re asking, you probably don’t need to convert to Eastern Time because SharePoint stores all dates and times in UTC. You’d only need to convert to Eastern Time if you want to display the date/time in the email message.

    I would also use a filter query in the Get items action rather than retrieving all items and then using a condition in an apply to each to check each one. This will greatly improve performance and prevent issues when the list exceeds 5,000 items. Just make sure the PM DATE field is indexed, as filter queries only work with indexed fields once your list hits 5,000 items.

    Here’s an example of a filter query from one of my flows to return items where the Notice Date is exactly 30 days from today (so you only send one reminder):
     
    NoticeDate ge '@{addDays(startOfDay(utcNow()),30)}' and NoticeDate le '@{addDays(startOfDay(utcNow()),31)}'
     
    You just need to replace NoticeDate with the internal name of your PM DATE field.
  • CU10021407-0 Profile Picture
    42 Season of Giving Solutions 2025 on at
    I got it to work!!! Thank you to all 3 of you for the help. I ended up with Tomacs solution in my last post, however, per David MA's reference to the dates needing to be in yyyy-MM-dd format, i changed those and it works perfectly now!!!

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 607

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard