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 / Comparing two dates an...
Power Automate
Unanswered

Comparing two dates and then either updating or Creating New

(0) ShareShare
ReportReport
Posted on by 163
Hi,
 
I have been going around in circles for a couple of days now trying to resolve this and am hoping someone here can help. I have a Power App that triggers a flow using Power Apps (V2) trigger. From the app I am passing two dates called PlanFrom and PlanTo into the app. PlanFrom will be 30/04/2024 and PlanTo will be March a year later for example 31/03/2025 and this will always be the case, however the years will vary. I am then using Get Items to loop through my SP list, and List rows present in a table to get all my data from an excel table. In my SP list is a column called EOMonth in the format 30/04/2024 02:01, so date and time which is slightly different to what I pass into the flow. I then need to check if the PlanFrom date passed into my flow exists in my EOMonth column in SP albeit in a slightly different format. If it does exist, I need to loop through my SP list and update all of my Plan column values with the new value from my list rows column called Value, where the date equals the date in my SP list. My EOMonth date and Month date in my table will be in the same format. If the PlanFrom Date does not exist in my SP list, it needs to loop through my List rows and create an item in the SP list for each item in my table. 
 
I hope this makes sense.
Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at
    Comparing two dates and then either updating or Creating New
     
    It's hard to offer any recommendations without seeing your full flow and the logic behind it. If you are using the new designer, toggle it off and click each action to expand it. Upload a screenshot of your flow in edit mode.
     
    In the meantime, it sounds like you want to compare your Excel to your SP List. You'll need to use a Filter Array action if you aren't already using that. Check out these YT tutorials to learn more about the Filter Array action.

    Are you using the Microsoft Power Automate Filter Array Action wrong?
    In this video tutorial I’ll show you 3 practical ways to use the Filter Array action and how to use it properly.
     
    1️⃣ Cross-Referencing Data
    2️⃣ Filtering by Key
    3️⃣ Substring Matching 
     
    Did you know that the Condition action has a limit of 10 conditions? Although it might look like the Filter Array action can only accept one condition—this is not true. By using the advanced mode you can enter multiple conditions into a Filter Array action with an expression. 
     
    IN THIS VIDEO:
    ✔ 3 Ways to Use the Filter Array Action
    ✔ How to use the Scope Action to Group Actions
    ✔ How to Check the Number of Items Returned from a Filter Array Action
    ✔ How to Cross-Reference Data in Excel with a SharePoint List
    ✔ How the Filter Array Action Works
    ✔ How to Access the Dynamic Content from a Filter Array Action
    ✔ How to Filter Items by a Key
    ✔ How to Filter Items by Matching a Substring
    ✔ How to Use Multiple Conditions in a Filter Array Action
    ---
     
    In this tutorial—I’m going to show you a quicker way to get the dynamic content from your Filter Array action—and it doesn’t require writing an expression.
     
    IN THIS VIDEO:
    ✔ How to Loop Through Filter Array Results in Power Automate
    ✔ Using Apply to Each with Filtered Arrays
    ✔ The Easiest Way to Access Dynamic Content from Filter Array
    ✔ Fixing Nested Apply to Each Actions
    ✔ When to Use Value vs. Body Dynamic Content
    ✔ Simplifying Power Automate Flows with Filter Array
    ✔ Troubleshooting Filter Array and Apply to Each Issues
     

    ---
    3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow
     
    In this video tutorial I’ll go over how to avoid these common mistakes when using the Apply to Each action in a Power Automate flow:
     
    1️⃣ Looping through a Single Item
    2️⃣ Creating Unnecessary Nested Loops
    3️⃣ Looping through an Unfiltered Array
     
    At the end of the video I share a few helpful insights when it comes to using the Apply to Each action in your flow.
     
    IN THIS VIDEO:
    ✔ How to Avoid the Apply to Each Action with a Single Item Array
    ✔ How to Use the item() Function to Access Dynamic Content in an Array
    ✔ How to Prevent Unnecessary Nested Apply to Each Action Loops
    ✔ How to Use the Select Action
    ✔ How to Convert an Array to a String with the Select Action
    ✔ How to Use the Filter Query Field
    ✔ How to Count the Number of Items in an Array
    ✔ How to Use a Condition Control
    ✔ How to Use the Concurrency Control
    ✔ How to Set a Top Count
    ✔ How to Use Compose Actions for Troubleshooting
     
     
     
    Hope this helps!

    Consider giving me a ❤️ if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • lalford09 Profile Picture
    163 on at
    Comparing two dates and then either updating or Creating New
    Thanks @creativeopinion. I have decided that what I can actually do is loop to see if the date in my Excel Month column exists in my SP EOMonth list column as they will be an exact match. However Even though the items already exist in my list, they are still always going down the Create Item route.
    My Condition expression is 
    contains(string(outputs('Get_items_Engaged_Customers')?['body/value']), formatDateTime(item()?['Month'], 'yyyy-MM-ddTHH:mm:ss')) and the value of my Apply to each is the value from my List rows present in a table. Does this help?
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at
    Comparing two dates and then either updating or Creating New
    It's inefficient to loop through all of your Excel rows and run a condition check on each row. Instead, you need to use the Filter Array action to filter the items you'd like to loop through. 
     
    It would be helpful to see the values you are comparing to each other. The reason your flow is going down the NO branch is because the Condition result is false. 

    The value in your left value field is not equal to what you have in the right value field (in this case it's empty). The contains() function will return a true/false value. You haven't entered a value in the right value field—so the condition will always result in a false value.


    For troubleshooting purposes, add a Compose action before you condition action and insert your expression into it. Review the outputs from your Compose action and you will see that your expression outputs a true/false value. 
     
    I cover how to troubleshoot a condition action in the first section of this YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows
     
    In this Power Automate tutorial, I explore 5 frequently asked questions that pop up when troubleshooting a flow. If you’d like to to level up your Power Automate flow skills and learn how to troubleshoot your Power Automate flow—this tutorial is for you!
     
    IN THIS VIDEO:
    ✅ How to troubleshoot a false Condition action result
    ✅ How to get dynamic content when it isn’t selectable from the list of dynamic content
    ✅ How to troubleshoot an Apply to Each action that isn’t looping through
    ✅ How to troubleshoot a skipped Apply to Each action
    ✅ How to troubleshoot a Filter Query
    ✅ How to use a SharePoint yes/no column in a Filter Query
    ✅ How to use Compose actions to troubleshoot a Power Automate flow
    ✅ How to troubleshoot multiple emails being sent
    ✅ How to troubleshoot multiple Teams messages being sent
     
    Hope this helps!
  • lalford09 Profile Picture
    163 on at
    Comparing two dates and then either updating or Creating New
    @creativeopinion I am comparing a date time in my SP list to a date and time in my excel file but currently formatted as General:
    If they exist in both then update the SP list, otherwise it would need to create the item.
  • lalford09 Profile Picture
    163 on at
    Comparing two dates and then either updating or Creating New
    @creativeopinion I have added a compose similar to your video of the EOMonth from my SP Get items and this is what it returns

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