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 Platform Community / Forums / Power Automate / Sending an email for a...
Power Automate
Answered

Sending an email for an expiration date 30 days out

(0) ShareShare
ReportReport
Posted on by 4
I need some help with a flow. I have everything running somewhat  smoothly, however I keep getting emails for items that are four months out, instead of 30 days. See attached images for reference. Thanks.

                                                                 
                                                                  
Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,081 on at
    Today is October 9th.
    Let's suppose you have 5 expiration dates:
    September 1st
    September 15th
    October 15th
    November 1st
    November 15th
     
    Which dates you wish to get?
  • CU09101514-0 Profile Picture
    4 on at
    @VictorIvanidze All of them that are 30 days away from being expired.
  • Verified answer
    Tomac Profile Picture
    4,072 Moderator on at
     
    Let's start by putting your Filter Query in plain language:
     
    For today minus 30 days, we will use 2025-09-09
    For today plus 30 days, we will use 2025-11-09
    These are just samples for ease of reading.
     
    Filter the results to return rows where ExpirationDate is either less than or equal to 2025-09-09 OR less than or equal to 2025-11-09
     
    So to begin, your filter is checking for two things but the second one includes the first one. In your description you said you're looking for ExpirationDate is 30 days out exactly, but I think you might mean 30 day or more? We'll do filters for both. You can copy/paste these directly into the Filter Query field and they will format the expressions as expected.
     
    First, exactly 30 days:
    ExpirationDate eq '@{addDays(utcnow(),30,'yyyy-MM-dd')}'
    We don't need FormatDateTime() because addDays() allows us to give the format as an argument. This will return rows where ExpirationDate is equal to today plus 30 days. Now, you'll need to check and make sure the data you're pulling from is using that same date format and isn't a datetime field that includes a timestamp. If it is, you'll have to adjust your Filter Query to account for that.
     
    Next, 30 or more days:
    ExpirationDate ge '@{addDays(utcnow(),30,'yyyy-MM-dd')}'
    Largely the same, but the operator is now Greater or Equal To
     
     
    The confusing part is where you said it's giving you ExpirationDate that is 4 months out - that shouldn't happen even with the query you're already using, so let's investigate that.
     
    In a completed flow run, expand the Get Items action and click Show Full Outputs. That will be the raw JSON of returned data. Take a look through the returned items and look for ExpirationDate in each of the returned results, what do they look like and how are they formatted? This information is likely the key needed to build your Filter Query correctly.
     
    If after seeing the format of your returned data you're still having trouble building the Filter Query, come back and show us those raw outputs so we can see what data Power Automate is working with and we can help you build a better filter. Feel free to blank out any private/company data from your outputs.

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 862

#2
Valantis Profile Picture

Valantis 738

#3
Haque Profile Picture

Haque 553

Last 30 days Overall leaderboard