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 / Remove Duplication bas...
Power Automate
Suggested Answer

Remove Duplication based on unique_Id

(2) ShareShare
ReportReport
Posted on by 286
Hi All,
 
in sharepoint i have column as Unique_Id, i need to remove the duplication of the unique_id how can i perform in power automate any idea on this.
example uniqueid like this
test_1
test_1
i need to keep one record and delete duplicate 
 
Categories:
I have the same question (0)
  • Suggested answer
    Haque Profile Picture
    3,653 on at
     
    When you retrieve tiem (using Get item action) and filter using (Unique_Id eq '@{triggerOutputs()?['body/Unique_Id']}')
     
    Try this expression in a condition:
    greater(length(body('Get_items')?['value']), 1)
    
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
  • André Arnaud de Calavon Profile Picture
    679 on at
    Hi Jawaharprem,
     
    What will be the trigger? Do you need to search for duplicates when a new SharePoint list item gets created or do you need to loop all existing items? Or do you know the unique_id and wants to run it only for one task?
    It would be great if you can clarify how you need help. Have you made an attempt and do you get stuck on a specific action?
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    Yes , you can remove duplicates in a Microsoft SharePoint list using Microsoft Power Automate.
     
    Goal
     
    From:
    test_1
    test_1
    test_2
     
    Keep:
    test_1
    test_2
    (Delete duplicates, keep one)
     
    (Recommended – Clean + Efficient)
     
    Step-by-step Flow

    1. Trigger
    • Manual / Scheduled (Recurrence)
    2. Get all items
    • Action: Get items
    • Select your SharePoint list
    3. Initialize variable (Array)
    • Name: varUniqueIds
    • Type: Array
    • Value: []
    4. Apply to each (loop items)
     
    Inside loop:
    • Condition: Check if already processed
    • contains(variables('varUniqueIds'), items('Apply_to_each')?['Unique_Id'])
    If YES (duplicate found)
    • Delete item
    • Action: Delete item
    • ID = current item ID
     If NO (first occurrence)
    • Keep it and store value
    • Action: Append to array variable
    • items('Apply_to_each')?['Unique_Id']
    Result
    • First record → kept 
    • Next duplicates → deleted 
    Important improvement (Sort first)
    Before loop:
    Sort items by:
    • Created date (ascending)
    Ensures:
    • Oldest record is kept
    • Newer duplicates deleted
     
    Thanks
    Manish
     
     
  • Suggested answer
    Kalathiya Profile Picture
    2,456 Super User 2026 Season 1 on at
    Hello @Jawaharprem,
     
    Yes, It's feasible using Power Automate. 
     
    Please follow below steps to do:
    #1. Set the Power Automate trigger  - Manually - If it's one time job and if you want delete the item daily basis then flow trigger should be scheduled. As per your requirement you can add. 
    For below example i have used manually trigger. 
     
    #2. Add the SharePoint Get Items action
    - Select the SharePoint Site and list - where from you want to delete the data.
     
    #3. Add the Select action
    From: Select the Value from Previous action output. 
     
    #4. Add compose action to find the unique value from previous action.
    Expression: 
    union(body('Select_|_Unique_ID'),body('Select_|_Unique_ID'))
    
    Note:
    body('Select_|_Unique_ID') - Previous action name - If your previous action name is different then please use accordingly. 
    
     
    #5. Add Apply to each loop action
    Select an output from previous steps - Select unique action compose that we have created before
     

     
    #6. Add Filter Array action for comparison
    From - Select the Get Item from SharePoint list action value -that we have from #2 step. 
    Select unique ID column and compare with current item 
     
    #7. Add condition action for check how many records we got based on above filter. If length is greater than 1 we need to perform delete operation for this item. 
    Expression:
    length(body('Filter_array_|_Unique_ID_Comparision'))
    Note: On length expression select the filter array body output in Expression. 
     
    #8. Add Apply to each action inside the condition yes Part.
    Apply to each loop action:
    Select an output from previous steps: Put below expreesion if you followed same naming conversation else inside the skip use filter array body action output that we have added in step #6.
    Expression:
    skip(body('Filter_array_|_Unique_ID_Comparision'),1)
     
    #9. Add delete action inside the apply to each as mentioned in above screen shot and select the SharePoint Site and List name from where you wants to delete the data. 
    ID property put below action: 
    item()?['ID']
    Note: Make sure to follow same naming conversation of action to avoid the issue in expression.
     
    If this response resolves your issue, please mark it as the Verified Answer so it can help other community members as well.
    ---------------------------------------------------------------------------------

    📩 Need more help? Just mention @Kalathiya and I’ll be happy to assist.

    ✔️ If this answer helped you, please tick “Does this answer your question?” so it can be marked as the Verified Answer.

    💛 A Like always motivates me to keep contributing!

    ​​​​​​​
     
  • David_MA Profile Picture
    14,956 Super User 2026 Season 1 on at
    In addition to the suggestions above for removing the duplicates via a workflow, once you get the duplicates removed, I would suggest enabling enforce unique values in your SharePoint list:
    This will prevent people from submitting an item with a duplicate value.
  • Chriddle Profile Picture
    8,708 Super User 2026 Season 1 on at
    The following expression returns a list of all SP list IDs of elements that follow an element with the same unique_Id
    (all but the first item of each unique_Id):
    xpath(
    	xml(
    		addProperty(
    			json('{}'),
    			'Root',
    			addProperty(
    				json('{}'),
    				'Item',
    				outputs('Get_items')?['body/value']
    			)
    		)
    	),
    	'//Item[preceding-sibling::Item/unique_Id = ./unique_Id]/ID/text()'
    )
     
    The entire flow is therefore as follows:
     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard