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 / Filtering query on Get...
Power Automate
Answered

Filtering query on Get Items by Created date

(1) ShareShare
ReportReport
Posted on by 57
Hi!
I have a flow, which has a step "Get items" and it gets items from a Sharepoint list. I would like it to:
- order them from oldest to newest, so in "Order By" I have "Created asc"
- get only items older then 90 days
- for testing purposes I added "Top Count"=1, cause my flow is supposed to delete those records, so I wanted to start with only 1 record
 
In "Filter query" I already tried the following, but I am always getting the same error (just the formatting mentioned in the error changes to the format that I am trying at the moment):
 
"Action 'Get_items' failed: The expression "Created le 2025-10-19T12:00:00Z" is not valid. Creating query failed."
 
So I tried the following:
 
Created le formatDateTime(addDays(utcNow(),-90),'yyyy-MM-ddT00:00:00Z')
 
Created le formatDateTime(addDays(utcNow(),-90),'yyyy-MM-ddT00:00:00')
 
Created le formatDateTime(addDays(utcNow(),-90),'yyyy-MM-dd')
 
Created le formatDateTime(addDays(utcNow(),-90),'g')
 
I tried also a different way - I added steps: Current time, Convert time zone, Subtract from time - which gave me "Calculated time" equal to "2025-10-19T00:00:00.0000000". 
The I tried both using it in filtering without further formatting it, as well as with formatting to several date formats. Always ended up with the mentioned error.
 
Please help me as I am completely clueless.
Thank you!
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    16,239 Super User 2026 Season 1 on at
    Hi there!
     
    You are really close and I hope this helps.  A recommendation is to always include a screenshot of the action you are using so we can actually see how you are entering your filter query.  Without the image, we'll guess a little.
     
    I think you may be typing in the actual expression into the filter query vs using an expression itself.  See how mine is developed in the filter query below.
     
    Ok, 2 things regardless:
     
    1)  your expression needs to be inside single parenthesis (shown below).
    2)  you are really close on the formatDateTime except the time is actually entered as THH:mm:ssZ  - note the capitalization on specific elements, it has to be exact.
     
     
    As the old saying goes....works in testing.
     
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and check the box below "Does this answer your question" to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

  • Fiilli Profile Picture
    57 on at
    Thank you so much!
    It was all about putting the expression between ' '.
    I would have never thought of it. Thank you!!
  • trice602 Profile Picture
    16,239 Super User 2026 Season 1 on at
    Very nice!  Have a great weekend and hope to catch up with you on the next thread too! 💯💯💯💯💯
  • lbendlin Profile Picture
    8,709 Super User 2026 Season 1 on at
    I don't think it is necessary to use formatDateTime.  Behind the scenes Power Automate is already using the ISO8601 format.

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 816

#2
Valantis Profile Picture

Valantis 603

#3
Haque Profile Picture

Haque 566

Last 30 days Overall leaderboard