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 / Odata Query to pre-fil...
Power Automate
Suggested Answer

Odata Query to pre-filter data for weekly task

(1) ShareShare
ReportReport
Posted on by 40
Hey folks, 
My goal is to have the query pull in all records older than 180 days.
I've been using copilot to help me troubleshoot it  but after hours of looping and not finding any working solution. I've come here.

So the current attempt at making the query work:
Initialize variable
addDays(utcNow(), -180, yyyy-MM-dd)
 
Get Items - Apply odata filter
field_3 lt '@{variables('Date180DaysAgo')}'


I'm looping between errors:
current error 
It seems that the error occurred due to a DateTime format issue in the filter query of the 'Get items' action. To fix this, ensure that the 'variables_Date___DaysAgo' parameter is correctly formatted as a DateTime string in the 'addDays' function. Check the syntax and format of the DateTime string to match the expected format in the filter query.

 
past error
It seems that the error occurred due to an issue with the filter query in the 'Get items' action. The expression "Field_3 lt 'addDays(utcNow(), -180, 'yyyy-MM-dd')'" is not valid because the function 'addDays' is being treated as a string instead of being evaluated as a function. To fix this error, you should remove the single quotes around the 'addDays(utcNow(), -180, 'yyyy-MM-dd')' function call in the filter query.
 
(in between these errors I learned field_3 was case sensitive, so I did fix that.) 
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,963 Moderator on at
    Hi,
     
    It would appear to me if you did that you typed in the expression rather than typed the expression in the popup expression window.
     
    You would do exactly that and wrap it in single quotes, but then its not treated as a string
     
    The proper way was to use the Dynamic Window, use the Expression Tab, type the expression stuff you want, then go to the Dynamic Tab to fill in the rest and click ok.
     
    Then have the Single quotes around that and it will work, no idea what you got going on :-)

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 784

#2
Valantis Profile Picture

Valantis 581

#3
Haque Profile Picture

Haque 545

Last 30 days Overall leaderboard