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 / Conditions not working
Power Automate
Answered

Conditions not working

(1) ShareShare
ReportReport
Posted on by 60
I have a flow that creates or updates an item in a SP list from an excel file. 
 
I use the table name from the excel file as the «title» column in the SP list. So, the first condition that I want the flow to check is if the SP list has an item title that matches the excel table. Then Update. If I just use this, then it works fine.
 
BUT,
I also want to add a second condition that if this item has the same fiscal year, then update, if not create a new item. This is where it stops working and always creates a new item, even if there is already an item there with both conditions.
 
Here is this part of the flow.
Any idea what I'm doing wrong?
 
Categories:
I have the same question (0)
  • JDucharme Profile Picture
    60 on at
    Ok. This is bizarre. I changed a few things in the SP list (My fiscal year column wasn't the right type), updated the flow and when I first tested it, it worked. Then I changed the fiscal year in my test excel and it created the new item. Great. I changed a number in the file and tested again, and this time, it created a new item (instead of updating it) but also updated the old item that was there. Help!
  • JDucharme Profile Picture
    60 on at
    I understand why it's updating and creating a new item. The flow is comparing both conditions separately, so it sees there is an item with the same title and updates it but it also sees that there are to different fiscal years so it creates an item.
     
    I tried separating the conditions, first by finding if there is an item in the list that has the title the same as the table title. Then, if no, create item. If yes, second condition to find if the fiscal years match. If yes, update item, if no create item.
     
    This still doesn't work. 
  • creativeopinion Profile Picture
    10,508 Moderator on at
    It's hard to offer any recommendations without seeing the logic behind your flow. In edit mode, click on each action to expand it. Upload a screenshot of your full flow. However, I can tell you that you will need to adjust the logic of your flow. It's always best practice to filter out your items first before looping through them and running a condition check on each item.
     
    Instead, what you want to do is cross check your Excel items against your SharePoint items first and filter out those that need to be updated and those that need to be created based on your conditions. You'll need to use a Filter Array action instead.
     
    You may be interested in this YT Tutorial where I cover how to do this:
     

    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
    If you still run into issues with your flow, upload screenshots of your full flow.
    Hope this helps!
     
  • Toussaint Profile Picture
    6 on at
    am facing a similar issue as well!! but am working on it
  • JDucharme Profile Picture
    60 on at
    Thanks for the video @creativeopinion 
     
    I'm trying it out but I must be missing something. Some parts are way too quick in the video and I seem to be missing something. 
     
    I like Power Automate for the ease of the logic for most connectors. Then we get to add this, string that, join this... and I get lost in the logic. I'm going to continue to push through it though.
  • sulemanji.com Profile Picture
    2 on at
    Potentially, as part of your two-step condition it's combined to one? (replace outputs() with appropriate dynamic vars) 
     
    and(
        equals(items('For_each')?['name'], outputs('Title_from_SharePoint')),
        equals(items('For_each')?['Body Année fiscale'], outputs('FiscalYear_from_SharePoint'))
    )
     
  • creativeopinion Profile Picture
    10,508 Moderator on at
    The issue you'll run into with in your flow if you don't use a Filter Array action is that you'll have to nest the Get Items or List Rows Present in a Table action inside an Apply to Each loop. This will make your flow inefficient as you only want to run those actions once. The purpose of the Filter Array action is to filter out the items that have been returned.
     
    You need two Filter Array actions.
    • Filter Array – Update Items: One to filter out the SP list items that exist in your Excel table. This will be the SP items that you need to update.
    • Filter Array – Create New: One to filter out the Excel Rows that don't already exist in SP. These will be the rows of data you want to add to SP.
    In order to filter these items out you need a string of unique identifiers to cross-check which items exist and which do not.
     
    Hope this helps!
  • JDucharme Profile Picture
    60 on at
    Thanks... I get the concept, I just can't figure out how to do it. I'm going to sleep on it and start fresh tomorrow morning.
     
    And what is going to complicate things is that i will have multiple tables in the real excel file. Each will be formatted exactly the same.
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,978 Moderator on at
    Hi
     
    If you do not share your flow, you are asking us to guess. Its not fair to do that and waste time. Always share your flow.
     
    The reason is obvious, you are comparing the correct input probably, but they have different representations of what the Date value looks like, and so therefor it fails.
     
    To find out for sure.
    Add a Compose Above the Condition in your flow
    in the Compose Input, all you need to do is this
    Add the purple one 
    Then I just want you to type - (yeap the dash)
    Then dd the other 
     
    So it looks like this
    - (the - is a dash not an underline its just the pictures not aligning)
    Either way, run the flow. Now you can go to the flow Run, and LOOK at the actual values it was comparing
    And bingo your answer.
     
    Next time though, please share your flow.
  • JDucharme Profile Picture
    60 on at
    I'm sorry. I'm newish to this. This flow is very long. How do I share the whole flow with all the variables, multiple screenshots?

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 976

#2
Valantis Profile Picture

Valantis 863

#3
Haque Profile Picture

Haque 547

Last 30 days Overall leaderboard