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 / How to compare two dat...
Power Automate
Unanswered

How to compare two dates by month in a "get items" filter query

(0) ShareShare
ReportReport
Posted on by 195

I have been trying to solve the following simple problem:

- send an email with the current month employee's anniversaries

 

The filter needs to isolate the month (MM) only for each variable

 

I have settled on "Get items" with a "Filter query" but have been unsuccessful. Anytime I try and set MM only, it fails with the following error:


InvalidTemplate. Unable to process template language expressions in action 'Get_items' inputs at line '1' and column '2528': 'In function 'formatDateTime', the value provided for date time string 'OData__x0077_q99' was not valid. The datetime string must match ISO 8601 format.'.

 

It works when I do not try and format the variables (instead of "ge" it should be "eq" but I was playing with it)

screen1.pngscreen2.png


Any ideas on how to make this work?

Categories:
I have the same question (0)
  • v-yuazh-msft Profile Picture
    on at

    Hi @wiredupjax,

     

    Could you please share more details about the date column in your sharepoint list with expression "OData__x0077_q99" in flow?

    You could take a try tp add a "Filter Array" action to filter the items meet your requirement.

     

    I have made a test on my side to create a "OData 99" column in the sahrepoint list as screenshot below:

    Capture.PNG

     

    You could refer to screenshot below to create the flow:

     

    Capture.PNG

     

    The expression in the initial variable as below:

    formatDateTime(utcNow(),'MM')

    The expression in the Filter Array as below:

    @equals(formatDateTime(item()?['OData_x0020_q99'], 'MM'), variables('Today_Date'))

    The flow would run successfully as below:

    Capture.PNG

     

     

    Best regards,

    Alice

     

     

  • wiredupjax Profile Picture
    195 on at

    Alice, looks good - how do I take the filter array data send it in a single email?  I only need a few columns from the record.

     

    I've seen some other solutions on the board: here and here

     

    However, when I begin to select certain fields, the "Apply to items" is automatically inserted, it drops the *body and switches items (which I switch back).

     

    I cannot take the HTML table BODY field outside the Apply to items loop and insert it into an email.  If I place the email inside the loop, then I get 10 emails instead of 1 with 10 items.

     

     

  • Verified answer
    v-yuazh-msft Profile Picture
    on at

    Hi @wiredupjax,

     

    Please refer to screenshot below:

    Capture.PNG

     

    Best regards,

    Alice

  • wiredupjax Profile Picture
    195 on at

    Correct! I missed that you need to chose fields as item()?['FIELDNAME']

    Thank you so much!

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard