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 Automate
Unanswered

Filter issues

(0) ShareShare
ReportReport
Posted on by 2

I have a flow that gets new responses from a MS Forms and transfers the answers into a master spreadsheet in team. The nest morning another flow goes into the master file and pull the responses from the last 24 hours. It works on day one but the following day it creates a new file with answers provided almost 2 days ago. I think the issue is that the filter does not include an "apply to each". I tried fixing it but now the filters does not work at all.

 

Original code:

@greater(formatDateTime(item()?['Completion time'], 'yyyy-MM-dd hh:mm:ss z'), addToTime(formatDateTime(utcNow(), 'yyyy-MM-dd hh:mm:ss z'), -28, 'Hour', 'yyyy-MM-dd hh:mm:ss z'))

 

New code (not working):

@greater(formatDateTime(item('Apply_to_each')?['Completion time'], 'yyyy-MM-dd hh:mm:ss z'), addToTime(formatDateTime(utcNow(), 'yyyy-MM-dd hh:mm:ss z'), -28, 'Hour', 'yyyy-MM-dd hh:mm:ss z'))

 

Error received:

InvalidTemplate. The execution of template action 'Filter_array' failed: The evaluation of 'query' action 'where' expression '@greater(formatDateTime(item('Apply_to_each')?['Start time'], 'yyyy-MM-dd hh:mm:ss z'), addToTime(formatDateTime(utcNow(), 'yyyy-MM-dd hh:mm:ss z'), -28, 'Hour', 'yyyy-MM-dd hh:mm:ss z'))' failed: 'The template language function 'item' must not have any parameters.'.

 

 

Categories:
  • coronj3 Profile Picture
    2 on at

    I'm using -28 hours because the difference between UTS and Eastern, this gives me the 24 hours I need. As you can see here the flow ran at 9:0034am, the cut off of 24 hours should be  8/28/23 9:00am but the filter returned records from 8/27/23. This only happens only happens on the second day after the first filter returns all the correct records.

    Screenshot 2023-08-30 002540.jpg
  • Chriddle Profile Picture
    8,729 Super User 2026 Season 2 on at
    1. Usually datetimes returned by Power Automate actions are UTC. If you want to compare them with utcNow() there is no need to consider time zones.
    2. If you really have to, use function convertTimeZone() https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#convertTimeZone
    3. There is no need to use the formatDateTime() function in your above experssions since Power Automate actions and functions return ISO 8601 formated datetime strings.
    4. item('Apply_to_each') is not valid. Do you mean items('Apply_to_each')

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 321 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 271

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard