web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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,433 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard