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 Apps / Remove Duplicate recor...
Power Apps
Suggested Answer

Remove Duplicate records and also Avoid Delegation issues

(0) ShareShare
ReportReport
Posted on by 51
Hi Team, 
 
I am Working on a Power App, where I am filtering the records from a Dataverse table, Called MSO, and that data is coming to the Table based on the Power Automate flow which is running in the back end and fetching the records from the SQL DW.
Now the Problem is like I am getting the duplicate WebOrders and now there is a issue of Duplicate records and I need to Avoid it and make sure the WebOrders coming from the table are Unique. 
// Gallery Items Property
ForAll(
    GroupBy(
        Filter(
            'Business Service Orders',
            !('BGM Status' = 3 || 'BGM Status' = 4) &&
            !('Status' = 5 || 'Status' = 6 || 'Status' = 7 || 'Status' = 8) &&
            'Service Type' = "TRNSPRT" &&
            !IsBlank(Quantity)
        ),
        "b2b_documentno",
        "GroupedRows"
    ),
    First(GroupedRows)
)
// Qty/Pkg Label
Concatenate(
    Text(First(ThisItem.GroupedRows).Quantity),
    "/",
    Text(First(ThisItem.GroupedRows).Total_Number_of_Packages)
)
// Date Label
Text(First(ThisItem.GroupedRows).Date, "dd/mm/yyyy")
// WebOrder No Label
ThisItem.b2b_documentno

When I am using the Group by, I will be facing a delegation issue, in the long term, SO now I need to come up with the Solution to make sure i won't be facing any issues in the future. Especially after going to Production or Live, so please help me out with the Suggestions and on how to Proceed further on this.  Below is the Current Logic I am using in the Gallery items property. 

Current Code I am Using:

SortByColumns(
Filter(
'Master Service Orders',
!('BGM Status' = 3 || 'BGM Status' = 4) &&
!('Status' = 5 || 'Status' = 6 || 'Status' = 7 || 'Status' = 8) &&
'Service Type' = "TRNSPRT" &&
!IsBlank(Quantity)
),
"b2b_documentno",
SortOrder.Descending
)
The status above refers to the Dataverse choice Columns, each Choice refers to the Number and those numbers i took directly as a reference.
Please help me out on this issue. Thank you 
Screenshot 2026-04-18 184144.jpg
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    1,271 on at
    Your current approach using GroupBy is not delegable and will fail at scale. The correct solution is to eliminate duplicates at the source—either in the SQL query used by your Power Automate flow or by enforcing uniqueness in Dataverse using an alternate key. Client-side deduplication in Power Apps should be avoided for production scenarios.
    • Fix it in Power Automate / SQL, not in Power Apps
     
  • Suggested answer
    Pstork1 Profile Picture
    69,323 Most Valuable Professional on at
    I suspect the best fix for this would be to filter out the duplicates in the flow before passing the data to the Power App.  An even better idea would be to do it using a stored procedure on the SQL server before the data is passed to Power Automate, but if you don't have access to create a stored procedure then do it in the flow. Either of those will decrease the amount of data being passed through the system which will increase performance and alleviate any issue with delegation in the Power App.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Suggested answer
    Vish WR Profile Picture
    807 on at

    Please note groupby isn’t delegable. It only works on the first 500 or 2000 records, so as your data grows, duplicates can start showing up again without you realizing it.

    A more reliable approach is to handle duplicates before the data reaches Power Apps. Since your flow is SQL → Power Automate → Dataverse, you’ve got better options upstream:

    • In SQL, use   DISTINCT or structure your query so that each b2b_documentno appears only once
    • In Power Automate, add a step to remove or check for duplicates before inserting records
    • In Dataverse, set b2b_documentno as an alternate key to enforce uniqueness

    Once duplicates are handled there, your Power Apps logic can stay simple and fully delegable (just Filter + SortByColumns), which will scale much better.

    Trying to fix duplicates inside Power Apps usually ends up being a temporary workaround rather than a proper solution.

    Vishnu WR
     
    Please  Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like 


     

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

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 510

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 281

Last 30 days Overall leaderboard