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 / SharePoint/Flow: Unabl...
Power Automate
Answered

SharePoint/Flow: Unable to use a Filter Query in a Get items action

(0) ShareShare
ReportReport
Posted on by 127

I have tried to filter by a date field and by a choice field, but they both result in an invalid expression error.

 

For the date field, I write: ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd')

 

and I get: The expression "ExpiryDate le 2018-06-22" is not valid. clientRequestId: 32c616f1-365e-4b8d-b0e7-1913c661f5b5 serviceRequestId: f766709e-8023-5000-d589-a40ee4e3f486

 

which shows that addDays(utcNow... is working. And ExpiryDate is a date field set to Date Only.

 

For filtering on a choice, I write: AccountStatus = 'Active'

 

and the error is: The expression "AccountStatus = 'Active'" is not valid. clientRequestId: 86b5f33a-6e81-4529-9de3-e74b57dc951f serviceRequestId: 4168709e-90db-5000-e4ca-2f66fd17f8b8

 

In the end, I need to have a compound conditions that ANDs these two together. But first, I would like to have them work separately. For now, I have almost 1,000 rows in my list, but it will double before too long and double again before it is mature.

 

Categories:
I have the same question (0)
  • Verified answer
    v-yamao-msft Profile Picture
    Microsoft Employee on at

     Hi @RKushner,

     

    For the date filed, I assume that you didn’t add a single quote around the function adddays in the Filter Query filed. Please configure the code under Expression tab then add a single quote around the code. Please take the following screenshot for a reference:

    1.PNG

     

     

    For the AccountChoice field, the code used in the Filter Query filed should be

    AccountChoice eq 'Inactive'

     

    And if you want to combine the two code together, please use the following code:

    ExpiryDate le addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd') and AccountChoice eq 'Inactive'

    2.PNG

     

    This doc about Filter expressions in Odata URLs could be helpful for you:

    https://docs.microsoft.com/en-us/previous-versions/dynamicsnav-2016/hh169248(v=nav.90)

     

     

     

    Best regards,

    Mabel Mao

     

     

  • RKushner Profile Picture
    127 on at

    For the date field, that works!!! 

     

    But for the Account choice field, that is what I am already doing, and it doesn't work:

     

    I write: AccountStatus = 'Active'

     

    and the error is: The expression "AccountStatus = 'Active'" is not valid. clientRequestId: 86b5f33a-6e81-4529-9de3-e74b57dc951f serviceRequestId: 4168709e-90db-5000-e4ca-2f66fd17f8b8

     

    I think that there is a special syntax for choice fields in conditions...

  • RKushner Profile Picture
    127 on at

    I am confused because even though AccountStatus = 'Active' doesn't work, putting the two conditions together (like you said, ExpiryDate le 'addDays(utcNow('yyyy-MM-dd'),10,'yyyy-MM-dd')' and AccountChoice eq 'Inactive') does work!!!

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard