cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Thyagi
Helper III
Helper III

Filter Query in MS Flow

Hello

 

I'm trying to filter 'Get Items' via Filter query by a field name called 'Roster_Date', basically I intend to retrieve any entries with Roster_Date less then 20 days from now. 

 

Expression picked up right date, but output isn't correct. Basically its pull all the entries in the SharePoint list. Ideally output should be about 100 items or even less.

My Flow Snapshot:

MS Flow_5.JPGlist. 

 

Appreciate if you could pin point where the mistake is please .

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-litu-msft
Community Support
Community Support

Hi @Thyagi,

 

What's the type of the Roster_Date column?

If it is a string column, it couldn't be compared as Date. When Flow run, they are compared as two numbers, for example:

two numbers 04-22-2019 and 03-22-2020, 04-22-2019 will greater than 03-22-2020, cause 04 is greater than 03.

The workaround is to change the Roster_Date column into a Date column. Or change the Roster_Date column's format to "yyyy-MM-dd", then filter query change into Roster_Date le formatDateTime(addDays(utcnow(),-20),'yyyy-MM-dd')

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Thyagi
Helper III
Helper III

Filter Query Expression I had used is :

Roster_Date le formatDateTime(addDays(utcnow(),-20),'MM-dd-yyyy')

v-litu-msft
Community Support
Community Support

Hi @Thyagi,

 

What's the type of the Roster_Date column?

If it is a string column, it couldn't be compared as Date. When Flow run, they are compared as two numbers, for example:

two numbers 04-22-2019 and 03-22-2020, 04-22-2019 will greater than 03-22-2020, cause 04 is greater than 03.

The workaround is to change the Roster_Date column into a Date column. Or change the Roster_Date column's format to "yyyy-MM-dd", then filter query change into Roster_Date le formatDateTime(addDays(utcnow(),-20),'yyyy-MM-dd')

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-litu-msft Roster_Date is of type 'Date/Time'

 

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,284)