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 / Filtering a List Rows ...
Power Automate
Answered

Filtering a List Rows (Dataverse) action using the output of another List Rows (Dataverse) action

(1) ShareShare
ReportReport
Posted on by 14
Hello community!
 
I've been banging my head against a wall for a few days now trying to solve what I thought was a simple issue. As the subject of my post says, I'm trying to filter a List Rows (Dataverse) action using another List Rows (Dataverse) action but getting errors in either sytax or incorrect expressions.
 
Background
I have 2 dataverse tables:
  • All stores: 800 stores
  • Stores to exclude: variable number of stores (10 - 20 and cxhanges each week)
 
I'm trying to list all of the stores from the All Stores table but filter the output by excluding the stores in the Stores to exclude table. This sounds like it should be a really simple task but for some reason I cannot find the right approach. I've tried the Filter Array action, various combinations of Select actions, and ChatGPT sends me all over the place! 
 
Could someone please point me in the right direction?
 
Many thanks for all and any helpdul advice!
Categories:
I have the same question (0)
  • Suggested answer
    Tomac Profile Picture
    4,061 Moderator on at
    While this example doesn't use Dataverse as the source, it should provide the structure you're looking for: https://tomriha.com/compare-two-arrays-e-g-sharepoint-lists-using-power-automate/
     
     
  • Suggested answer
    Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    Hi @LeeSteventon , you can try this approach :

    1. Compose - Exclude List: (populate the filter list from another table in array format) (use select operation)

    2.List rows (pull data from stores table with no filters) (if required).

    3. Select (filter logic will start here - we add a flag to filter correct records) (Add more columns if required)

    4. Final Filter array to get flag = true records

     
  • LeeSteventon Profile Picture
    14 on at
    Hello @Power Apps 1919 and many thanks for your response.
     
    However, I'm struggling to reproduce your step 1 - Compose Exclude List, as the Select action produces Key Value pairs, and if the Key is left empty and just a value entered dynamically, Select produces an output like the following and not a flat array as I think is needed :
     
    [
      {
        "":   "Store 1"
      },
      {
        "":    "Store 2"
      }
    [
  • Suggested answer
    Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    Hi @LeeSteventon,
    you can try this:
    1.
     
    2. Click on "Switch Map to Key value mode"

    3. In the Map add the dynamic content.

    That should work
  • LeeSteventon Profile Picture
    14 on at
    Hi @Power Apps 1919,
     
    OK, I fixed the flat array issue ( a simple item()?['be_name'] expression fixed that).
     
    However, the flow still doesn't work. It seems that the expression not(contains(outputs('Select_-_Exclude_List'),item()?['be_name'])) in the Select action to set the flag is not working, as it sets the value true to all the stores listed including the ones that are in the Exclude List. Therefore the Filter Array action does not filter them out. I've checked the format on both fields in both tables are they are the same (text), I've checked for leading and trailing spaces, there are none.
     
    Any ideas?
     
  • Suggested answer
    Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    Hi @LeeSteventon,
    Can you share screenshot of the flow developed by u with formulas, so i can debug where the error could be and solve it
  • LeeSteventon Profile Picture
    14 on at
    Hello,
     
    Below is a complete flow that I built with a shorter list of stores just for testing.
     
    The complete flow
     
     
     
     
    Step 1- List Rows from the table that contains the stores to be excluded.
     
     
    The Excluded Stores table in dataverse that this applies to looks like this:
     
     
    The StoreID column is the Primary Column and has the logical name be_name
     
     
    Step 2 - Create a flat file array
     
     
    This step creates the flat array of Store ID's to exclude further down the flow. The output of this step looks like this:
     
     
     
     
    Step 3 - List all the stores from the main list, I created a simple table with one column and 3 entries, just for testing
     
     
    The testExcludes table looks like this, single column (StoreID). This column is the Primary Column for this table and also has a logical name of be_name.
     
     
     
    Step 4 - Select action to assign the flag
     
    Takes the output of the "List rows - All Stores action" for the From field - outputs('List_rows_-_All_Stores')?['body/value'] - and creates the following two Maps:
     
    • Store ID > item()?['be_name'] (Power Automate then translates that to StoreID)
    • flag > not(contains(outputs('Select_-_Exclude_List'),item()?['be_name']))
     
     
    The output is as follows:
     
    [
      {
        "Store ID""47777",
        "flag"true
      },
      {
        "Store ID""48748",
        "flag"true
      },
      {
        "Store ID""45999",
        "flag"true
      }
    ]
     
    This is where I think the error occurs, issue is. Store ID 47777 should not be set to true as it's one of the stores in the Exclude List
     
     
    Step 5 - Filter the array to only show stores with a flag = true
     
    Takes the oupt of the Select action for the From field - body('Select')
     
     
    Output is of course the same as the Select action
     
     
     
     
  • Verified answer
    Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    Hi @LeeSteventon,
    I was able to replicate your issue,
    this is the fix:
    Using body instead of Outputs (As outputs is creating a json object with body inside).



    If we use Outputs.
    Sample compose:

    when we run it, we get:
  • LeeSteventon Profile Picture
    14 on at
     
    That fixed it!
     
    Many thanks!

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 959

#2
Valantis Profile Picture

Valantis 872

#3
Haque Profile Picture

Haque 589

Last 30 days Overall leaderboard