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 / Attempting to compare ...
Power Automate
Answered

Attempting to compare Dates (Older than X days workflow)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I apologize in advance if there was a post that answers this question. Dozens of searches here didn't find me a working currently useable solution.

 

I'm attempting to create a workflow that sends a summary email of all items in a sharepoint list that are older than 7 days, based off of a date column 'DateAdded' formatted in MM/DD/YYYY format.

 

I can't tell if I'm supposed to be using ticks or a lessorequals comparison using the current date with utcnow or what the heck to do.

 

I was trying to start using a variable similiar to the expression - (From https://sympmarc.com/2021/02/22/calculate-the-difference-between-two-dates-in-power-automate/)

 

div(sub(ticks(formatDateTime(utcNow(),'yyy-MM-dd')),ticks(item()?['Modified'])),864000000000)

 

 

Trying to use the DateAdded column in place of 'modified' but given that modified is a built in item property I'm probably on the wrong track.

 

Anyone have any beginner friendly tips?

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Anonymous 

     

    Please see below I am filtering based on Modifed on date for the last 7 days.

     

    image.png

     

    Above expression I used is as follows:

     

    formatDateTime(addDays(utcNow(),-7),'yyyy-MM-dd')
     
     
    Replace Modified field to DateAdded for your query.
     
    Thanks
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hey @abm ,

     

    It doesn't look like that solution worked. Get items with Filter Query gave the following output fail error from the example code you posted modified to be using DateAdded instead of Modified:

     

    "status": 400,
     "message": "The expression \"2021-12-21eq 2021-12-14\" is not valid. Creating query failed.\r\nclientRequestId: 5387495a-f009-4658-8475-e2c61c0f8b36\r\nserviceRequestId: 5387495a-f009-4658-8475-e2c61c0f8b36"

     

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Could you try the filter array action?

    vxiaochenmsft_0-1640157742719.png

    vxiaochenmsft_1-1640157758100.png

    addDays(utcNow(),-7)
     
    vxiaochenmsft_2-1640157804268.png

     

    Best Regards,

    Wearsky

  • abm abm Profile Picture
    32,985 Most Valuable Professional on at

    Hi @Anonymous 

     

    Looks like there is a space needed between your query. See below you have 021-12-21eq without spaces

     

    021-12-21eq 2021-12-14\

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I ended up abandoning the use of a custom entered date column (DateAdded) and used the default created. After that using a filter query for the created column was what was able to work for what I needed.

     

    Filter Query: created le 'AddDays(utcNow(), -7)'

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 639

#2
Valantis Profile Picture

Valantis 392

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard