Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

How to remove duplicates but keep item that was just created/modified?

(0) ShareShare
ReportReport
Posted on by 26

I have an attendance sheet that is set up like this:

jakefromstfarm_0-1712260938679.png

This feeds into a Power BI visualization where the visualization breaks out the dates between start and end dates. I also have a flow that can break up the dates between the start and end dates as well, but have them turned off at the moment.

 

The flow I'm having trouble creating should check if the item that's being created or modified matches the start date and name of something already in the list. If it matches, it will delete the old instance (duplicate).

I want to do this since people make mistakes inputting their attendance and can influence the data in the Power BI visualization. Is there a way to do this in Power Automate? Modified and Modified by are metadata columns.

  • Verified answer
    v-yetonggu-msft Profile Picture
    on at
    Re: How to remove duplicates but keep item that was just created/modified?

    Hi @jakefromstfarm ,

    Below I followed @Chriddle  reminder to modify the flow:

    My SharePoint List:

    vyetonggumsft_3-1712310632536.png

    In Filter Query, we need to use the internal name of the column to filter.

    When there are special characters such as spaces, '_', '/' and other special characters in the column name, the display name will be different from the internal name, then we need to jump to the edit interface of the list to view the internal name of the column.

    Here are the steps to see the internal name of the start date.

    vyetonggumsft_4-1712310668277.png

    vyetonggumsft_5-1712311229890.png

    vyetonggumsft_6-1712311402620.pngMy Flow:

    vyetonggumsft_7-1712311509087.png

     

    Title eq '@{triggerOutputs()?['body/Title']}' and internalname eq '@{triggerOutputs()?['body/internalname']}' and Created lt '@{triggerOutputs()?['body/Created']}'

     

    Best Regards,

    Sunshine Gu

  • v-yetonggu-msft Profile Picture
    on at
    Re: How to remove duplicates but keep item that was just created/modified?

    Hi @Chriddle ,

    I know what you mean, thank you for the reminde.

    However, in order to avoid using the internal name of Start Date in OData Filter, so that users do not need to look at the internal column names.

    Best Regards,

    Sunshine Gu

  • Chriddle Profile Picture
    7,932 Super User 2025 Season 1 on at
    Re: How to remove duplicates but keep item that was just created/modified?

    Don't iterate all items. First, filter for items you want to delete.

  • v-yetonggu-msft Profile Picture
    on at
    Re: How to remove duplicates but keep item that was just created/modified?

    Hi @jakefromstfarm ,

    @Rhiassuring One of his logical mistakes is that he would delete the newly created item and the original item at the same time.

    I recommend that you add 'Title' equals 'Title' and 'Start Date' equals 'Start Date', and then add that the created time of the item that meets these two conditions is less than the created time of the new item, so as to avoid the situation that the newly created item and the original item are deleted at the same time.

    I did a test for your reference.

    In my scenario:

    vyetonggumsft_1-1712298103320.png

    vyetonggumsft_2-1712298381203.png

    vyetonggumsft_3-1712298475282.png

    Best Regards,

    Sunshine Gu

  • Rhiassuring Profile Picture
    8,688 Super User 2025 Season 1 on at
    Re: How to remove duplicates but keep item that was just created/modified?

    Hi there, 

     

    So what you'll want to do is on Creation / Modification (trigger), use a "Get Items", and a Filter Query of Title eq 'XXXX' and Start Date eq 'XXXXX'  [ where the XXXX is dynamic content from your trigger pointing to the same piece of data.]

     

    Then you can use a Condition. The condition will be length()  where inside of the () you'll point to the body output from your Get Items. If the length is 0, then no duplicate found. If the length is NOT 0, then you'll have found a duplicate and can delete it.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1