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 / Finding Last User Entr...
Power Automate
Answered

Finding Last User Entries in SharePoint List

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a SharePoint list that basically is a history list of user submissions.  One of the fields is the type of submission (kind of like a status).  For each user, I need to find out what their latest submission status was.

 

UserSubmission TypeDate submittedOther Fields
FrankA11/1/2021Info
JeffB11/3/2021Info
FrankB11/2/2021Info
JeffA11/5/2021Info
SueC11/7/2021Info

 

Output I'm looking for: Frank = B, Jeff = A and Sue = C.

 

I thought I'd use an ODATA query to first just get the fields I need, and then go from there.  I actually thought it would be best to start from the bottom of the list.  Once a person's name was encountered, that was their final status.  I would then have to ignore that person as I go up the list.

In the end, I need to produce a report, as both an HTML table in an email and also, if possible, an Excel sheet.

 

I've done a little with ODATA, tables and emails, but nothing like this.  I'm not sure if it's even possible with Power Automate.  Can it be done using internal arrays in the Flow, or might I need it to create extra SharePoint temp/working lists?

 

Thanks!

Categories:
I have the same question (0)
  • mahoneypat Profile Picture
    1,720 on at

    This would be much easier in Power BI.  Have you considered using that instead?

     

    Pat

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Unfortunately, we're not licensed for Power BI.  😞

    I was thinking of maybe adding a "current status" field and using Power Automate to designate the last entry.  When a new entry is added, "current status" would always be set to true, then a flow would kick off that would set current status to false for all entries for that user, other than the one that kicked off the flow.  Maybe it could grab the ID of the added entry to be sure it excludes that one.

     

    Then, the report would only include any entries where "current status" is true.

  • Verified answer
    mahoneypat Profile Picture
    1,720 on at

    Here is one way to do it, assuming the one to keep for each person is the last one for that name (that was the case in your example data).  I put your table an an input array (in json format) to simulate your get items step.  Then here are the steps:

     

    - Select step to get just the values of the Name field

    - Compose step with Union of the select to itself (to get distinct list of names)

    - Initialize two variables - one array to hold the final result, and one string to hold the current name while iterating in the Apply to each step

    - ATE step that iterates over the distinct array of names

    - for each name, set the variable to that name, filter the input array for name = that variable, and then append the last() of that filtered array to the array variable

     

    mahoneypat_0-1637192680756.png

     

    mahoneypat_1-1637192690857.png

     

    final result has the desired 3 rows

    mahoneypat_2-1637193012918.png

     

    Pat

     

     

  • mahoneypat Profile Picture
    1,720 on at

    @UkimanPA Did this approach work for you?

     

    Pat

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you, Pat!  I am sorry for not responding sooner, but the initiative I was involved in which had that requirement was canceled, so I couldn't put more effort into it.  I have another Power Automate/Apps project that may require something pretty similar.  Since a SharePoint list can't be queried like a SQL or Dataverse table, I am intrigued with your example of reading the entire list into an array and they querying that array for results.

    I am trying to avoid the extra licensing for Dataverse, which I believe requires a premium per-user license at about $12/mo per user.  I am seeing if Power Apps can also read and entire SharePoint list into an array for querying.  Please let me know if you have any experience or thoughts around this.


    Again, sorry for the late reply!

  • Rick_black Profile Picture
    186 on at

    Hey @mahoneypat , I want to achieve the exact same. However, I don't fully understand your solution. Could you expound, please?.

  • mahoneypat Profile Picture
    1,720 on at

    @Rick_black  I tried to put the expression in the comments throughout. Which parts would you like me to clarify further?

    Pat

     

  • takolota1 Profile Picture
    4,978 Moderator on at

    This template gives the largest / most recent or the smallest / oldest records for unique values in given columns. Kind of a Group By, then Max or Min.

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Get-Distinct-Records/td-p/2191533

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!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 283

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard