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 / AddDays help - was wor...
Power Automate
Answered

AddDays help - was working until 2022

(0) ShareShare
ReportReport
Posted on by 28

I have an automated workflow that runs every morning (tried to attach a pic of the flow as a cover photo). The workflow looks at 2 folder locations on sharepoint, pulls in Get files (properties only) and then filters this data to ultimately send an email with 2 tables of all the files created/added the previous day. 

 

This worked great until we hit 2022. Now when the workflow runs it is generating a massive list of files created/added since the previous day. I feel like it's ignoring the year and just pulling together a list of everything created since Jan 2 without checking the year? 

 

Filter array is doing this: 

formatDateTime(item()?['Created'], 'MM/dd/yyyy')
is greater than or equal to
AddDays(utcnow(), -1, 'MM/dd/yyyy')
 
advanced mode if you prefer: @greaterOrEquals(formatDateTime(item()?['Created'], 'MM/dd/yyyy'), AddDays(utcnow(), -1, 'MM/dd/yyyy'))
 
Can anyone help?
Categories:
I have the same question (0)
  • BrianQW Profile Picture
    28 on at

    workflow.jpg

  • Verified answer
    Jronash Profile Picture
    827 on at

    This actually makes some sense, because your greaterThanOrEquals expression is comparing the dates as numbers, not dates.

     

    As numbers, 12/31/2021 is greater than 01/01/2022.

     

    So you need to reformat your dates so that it results in a number where the higher the date, the higher the number.  Try it in Year/Month/Day format : 

    formatDateTime(item()?['Created'], 'yyyyMMdd')
    AddDays(utcnow(), -1, 'yyyyMMdd')
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @BrianQW ï¼Œ

     

    Using FormatDateTime will convert date time values to string(dd-MM-yyyy or dd/MM/yyyy), which could not be compared properly because of the minus or slash(division) sign.

     

    Please use the Created column value and compare it with AddDays(utcnow(), -1) without formatting text:

    @greaterOrEquals(item()?['Created'], AddDays(utcnow(), -1))

    vjefferni_0-1641436317055.png

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • BrianQW Profile Picture
    28 on at

    Thank you both!!!! This isn't easy for a finance guy 🙂 

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!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 103 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 87

#3
trice602 Profile Picture

trice602 63 Super User 2026 Season 1

Last 30 days Overall leaderboard