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 / Using Filter Array wit...
Power Automate
Answered

Using Filter Array with Planner Dates and UTC(now)

(0) ShareShare
ReportReport
Posted on by 44

Hello,

I have a flow that will periodically that is supposed to filter for Planner tasks that have due dates more than 30 days from today.  

augustine2_1-1634049166732.png

 

We are initializing today's date as string as 'TestDate'.  The value for TestDate is

formatDateTime(addDays(utcNow(),-30),'yyyy-MM-ddThh:mm:ssZ').
 
We use a filter array where due date is less than TestDate which should bring tasks that have due dates more than 30 days from today.  However, we are getting the error "The execution of template action 'Filter_array_3' failed: The evaluation of 'query' action 'where' expression '@less(items('Apply_to_each_2')?['dueDateTime'], variables('TestDate'))' failed: 'The template language function 'less' expects two parameter of matching types. The function was invoked with values of type 'Null' and 'String' that do not match.'.

 

We want to ultimately use the "Delete a Task" Planner action to bulk delete these tasks.  But we can't get past this stage.

Any help will be greatly appreciated.

Categories:
I have the same question (0)
  • Ellis Karim Profile Picture
    11,994 Super User 2026 Season 1 on at

    This error is due to the fact that some of your tasks do not have due dates. It fails because it is trying to compare a null value with a date-time variables('TestDate').

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • tom_riha Profile Picture
    10,187 Most Valuable Professional on at

    Hello @augustine2 ,

    move the 'Filter array' out of the 'Apply to each', you don't need to process the tasks one by one, Filter array will take the whole array and filter it.

    The 'Apply to each' and the error was caused because you entered the 'value Due Date' first in the 'Filter array', you should enter the From 'value' first and only then the 'value Due Date', that way it won't add the loop.

     

  • augustine2 Profile Picture
    44 on at

    thank you much.  I filtered out the nulls and still had the same error.

  • augustine2 Profile Picture
    44 on at

    Let me try this and will let you know.

  • augustine2 Profile Picture
    44 on at

    I can't really take move the filter array out of the "Apply to Each" because of the List Tasks action. 

     So, I tried this:

    augustine2_1-1634063264700.png

     

    But, I'm getting this error: 

    The 'from' property value in the 'query' action inputs is of type 'Object'. The value must be an array.

  • Verified answer
    Ellis Karim Profile Picture
    11,994 Super User 2026 Season 1 on at

    @tom_rihasuggestion is for the flow to look something like this:

    ekarim2020_1-1634063851158.png

     

    Ellis

  • augustine2 Profile Picture
    44 on at

    Got it! Thank you

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 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard