web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Filter Query not worki...
Power Automate
Unanswered

Filter Query not working as desired

(0) ShareShare
ReportReport
Posted on by 2
Hey Team,
 
I have a flow that is as follows:

When a response is submitted (MS Form) > Get response details > List rows present in a table > Filter array > Condition > If Yes add row to a table > If no send an email
 
The filter array should assess whether StakeholderEmailAddress AND DateofEngagement match existing data in the excel table called Automate - if there is a match with both columns then the flow should follow the No branch and send an email.
 
If there is no match then the flow should follow the yes branch and add a row to the table with the response details. This is to avoid duplicate entries.
 
The filter array I am using is:
 
@and(
    equals(item()?['StakeHolderEmailAddress'], triggerOutputs()?['body/StakeHolderEmailAddress']),
    equals(item()?['DateofEngagement'], triggerOutputs()?['body/DateofEngagement'])
)
 
The flow runs successfully every time but it duplicates an entry every time even if the StakeholderEmailAddress and the DateofEngagement are entered as matching values on the MS Form each time.
 
The condition I am using is:
 
 
empty(body('Filter_array'))
 
is equal to true (entered as an expression)
 
 
 
 
 
Can anyone assist with why the filter array is not identifying the matching entries and following the No branch, but adding a duplicate row each time? 

For clarity if the StakeHolderEmailAddress matches but the DateofEngagement doesn't then a new row should be added - this is because we want to capture whether the same stakeholders have been engaged with on different dates; the only time a row should not be added is if the two columns data match.
 
 
 
 
 
 
 
 
 
Categories:
I have the same question (0)
  • Anchov Profile Picture
    1,986 on at
    Filter Query not working as desired
    The way I usually handle this is by using the length() formula to check if there are any rows in your array. Here's an example:
    length(body('Filter_array')) > 0
    If this condition evaluates to true, it means there are rows in your filtered array, and you can proceed to perform the desired actions.
  • Ellis Karim Profile Picture
    11,653 Super User 2025 Season 2 on at
    Filter Query not working as desired
    You also need to examine the data, which may explain what is causing your unexpected results.
     
    I suggest you take a look at your dates data. What are the formats of the dates? Are you comparing like for like?
     
    2024-12-06T00:00Z = 06/12/2024 12:06:00 ?????
    2024-12-06T00:00Z = 2024-12-06T18:03Z ????
     
     
    Ellis
     
     
  • Suggested answer
    CU06121221-0 Profile Picture
    2 on at
    Filter Query not working as desired
    Hey guys, 
     
    Thanks for the replies thus far, I fixed it. In case anyone else experiences this issue the solution is below:
     
    The issue was around how MS Forms, Excel and PowerAutomate handle and store date formats.
     
    The expression for the filter array in advanced edit mode is:
     
    @and(
        equals(item()?['StakeHolderEmailAddress'], outputs('Get_response_details')?['body/r0e6dd137e71e4d07a71e84f1b9b273b6']),
        equals(addDays('1899-12-30', int(item()?['DateofEngagement']), 'yyyy-MM-dd'), outputs('Get_response_details')?['body/r906be3877e834e358f78636977d8e3fa'])
    )
     
    This flow all works like a treat now with perfect date handling between platforms.

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
Tomac Profile Picture

Tomac 497 Moderator

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 477 Super User 2025 Season 2

#3
chiaraalina Profile Picture

chiaraalina 242

Last 30 days Overall leaderboard