web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Get only the newest sharepoint list item if there are duplicates

(0) ShareShare
ReportReport
Posted on by 32

Hi guys,

I'm currently implementing a flow for our expenses list.

For every monthly recurrent expense it's supposed to create a new entry every month until the usage period is reached.

The recurrent expense will have the same Identifier as the initial entry e.g. "IT-REF-0016".

I'm stuck cause I don't know how to get only the newest item if the Identifier occurs more than once.

Thanks for the help!

Simon

 

flow_mrc.png

 

I have the same question (0)
  • ChristianAbata Profile Picture
    8,949 Most Valuable Professional on at
    Re: Get only the newest sharepoint list item if there are duplicates

    hi @simonschork  Maeby you could use the created date of item, so then you can  compare items by date.

  • simonschork Profile Picture
    32 on at
    Re: Get only the newest sharepoint list item if there are duplicates

    Hi @ChristianAbata, thanks for the answer!

    My first attempt was to order the the returned items by "Created on" descending and pick the top 1.

    But in this case it obviusly only returns the latest items. I guess I have to use an expression within the "Filter Query" field of "Get items" but I have no clue how to syntax these right nor did I find a fitting function for my case on the Reference guide for functions in the documentation.

    Do you have an example for this kind of expression or filter query?

    Maybe I also make things a little to complicated and there is an easier way. I'm quit new to Flow.

     

    Edit: Another attempt could be comparing ID and only keeping the higher one, but I'm still stuck on how to compare items with same value in the identifier column.

  • Verified answer
    v-bacao-msft Profile Picture
    on at
    Re: Get only the newest sharepoint list item if there are duplicates

     

    Hi @simonschork ,

     

    It seems that you need to group items first, and then filter out the newest list item based on Created or item ID:

    Please check this blog and see if it helps:

    http://johnliu.net/blog/2018/6/do-group-by-in-flow-with-two-simple-elegant-loops

     

    Best Regards,

  • takolota1 Profile Picture
    4,944 Moderator on at
    Re: Get only the newest sharepoint list item if there are duplicates

    You can also use this template to get only the unique values & get the most recent or oldest values: https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Get-Distinct-Records/m-p/2191533#M1615

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 614 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 401 Moderator

#3
chiaraalina Profile Picture

chiaraalina 282

Last 30 days Overall leaderboard