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 / How to get the last en...
Power Apps
Answered

How to get the last entry of each unique item from SP

(0) ShareShare
ReportReport
Posted on by 9

Hi All,

I want to get the last record of each Tag (Only Lines with red cross at the front) and display them in a Gallery. My data are stored in a SP list.

I tried with ForAll loop but i didn't get the expected result.

 

Maybe someone could help me.

 

Thx for any help you will bring me.

 

Ycrad_0-1648211450691.png

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    I think that the only way is this:

     

    Set(varTagsAlreadyIn, "");

     

    ForAll(

    Sort(DataSource, ID, Descending),

    If(!(Tag in varTagsAlreadyIn),

     

    //IT IS THE FIRST ONE

    Set(varNewTag, varTagsAlreadyIn & " ," & Tag);

    Set(varTagsAlreadyIn, varNewTag),

     

    //IT IS NOT THE FIRST

    )

     

    I am creating 2 vars because you cant self reference in Power Apps.

    You can always try with Concat or Concatenate but I am not sure how to do it

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,

    Gonçalo Nogueira

    Check my LinkedIn!

    Buy me a coffee!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • Ycrad Profile Picture
    9 on at

    Thank you Nogueira 1306 for your response,

     

    But it seems that Set function could not be called in ForAll function. The system returns an error and i don't know why... 😞 

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Ycrad 

    I disagree with the approach. Much simpler without variables:
     Use GroupBy(Sort(SPlist,ID,Descending),"Tag","Info") as your Items property of the gallery. 
    Then inside the gallery put labels with text property as "Tag", First(ThisItem.Info).Posted, First(ThisItem.Info).'Eqpt Name', etc.

  • Ycrad Profile Picture
    9 on at

    Dear Drrickryp,

     

    Thanks a lot for your answer. That is exactly what i was looking for.

     

    God bless U,

     

    Thank you.

     

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    happy.jpg

     

  • Ycrad Profile Picture
    9 on at

    Drrickryp,

     

    So, if i want to get between these unique last entries only those match with some criteria as TestStatus="Fail" or TestStatus="Succes" but DateDiff(Created;NextTest)<0 how can i Do?

    My Collection is called Lune :

    ClearCollect(Lune;GroupBy(Sort(Filter(TestsData;Site=CombSite_2.Selected.Title);ID;Descending);"TagEquipement";"Info"));

    When i tried to get the result into another Collection called LuneResult with :

    Clearcollect(LuneResult;Filter(Lune;Info.TestStatus="Fail" || (Info.TestStatus="Success" && DateDiff(Created;NextTest)))<0 ;

    I don't get the expected result.

     

    Could you help please ?

     

    Thank you.

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 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard