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 / Syntax error with ODAT...
Power Automate
Answered

Syntax error with ODATA filter query, formatDateTime

(1) ShareShare
ReportReport
Posted on by 4
I am trying to get information from an Excel workbook and then filter the results by a yesterdays date. Each time I add formatDateTime to the ODATE filter, it fails.
 
My filter is DATE eq '@formatDateTime(addDays(utcNow(),-1),'yyyy-MM-dd)'
 
I can't see the problem with this statement. 
Further to a straight formatDateTime, I have used 2 Compose operations. One to subtract a day and one to format the date, but each time I use formatDateTime it fails.
 
Any ideas?
Categories:
I have the same question (0)
  • Matthias PPS Profile Picture
    70 on at
    @JH-30040830-0 What is the error message?
  • JH-30040830-0 Profile Picture
    4 on at
    It just says there is invalid syntax at a position. I have taken this further, I tried just using addDays, but as soon as I put a format in it failed with the same syntax error. It always says the date format is invalid
  • Verified answer
    stampcoin Profile Picture
    5,158 Super User 2026 Season 1 on at
    According the info you provided:
    Please refer to this one:
    DATE eq '@{formatDateTime(addDays(utcNow(), -1), 'yyyy-MM-dd')}'
     
    Advanced mode:
     
    OData filter expects dates in quotes.
    Power Automate expressions must be wrapped in @{} for evaluation.
    You must not include additional single quotes outside of the expression, otherwise the evaluation won't occur correctly.
     
     
     

    Enjoy Power Platform and have a great day 🚀 |  My LinkedIn

    If the answer helps, please consider 👍, Thanks.

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 632

#2
Haque Profile Picture

Haque 458

#3
Valantis Profile Picture

Valantis 357

Last 30 days Overall leaderboard