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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery by Most...
Power Apps
Answered

Filter Gallery by Most Recently Updated

(0) ShareShare
ReportReport
Posted on by 26
Hello,
 
I have a choice column on a SharePoint list with 7 different choices. I want to view in the gallery only the most recently added item for each choice. Is there a way for me to filter a gallery to be that specific? 
 
Thank you!
Categories:
I have the same question (0)
  • Verified answer
    Sunil Kumar Pashikanti Profile Picture
    762 Moderator on at
     
    Goal: For each choice (7 values), pick the single row with the latest Modified date.
    Preload once to a collection (good for performance/UI)
    Populate a tiny 7‑row collection and bind your gallery to it. This is great if you don’t need the set to live refresh every second.
    Example: put this on a Refresh button OnSelect or on App.OnStart (and call Refresh() logic when needed).
    ClearCollect(
        colLatestPerChoice,
        With(
            { src: MyList },
            ForAll(
                Distinct(src, Status.Value),
                First(
                    SortByColumns(
                        Filter(src, Status.Value = Result),
                        "Modified",
                        Descending, 
                        "ID", 
                        Descending
                    )
                )
            )
        )
    );
    // Then set Gallery.Items = colLatestPerChoice
    Replace Status with your actual Choice column, MyList with actual list.
    Modified is the SharePoint system column for the last edit timestamp; adjust if you use a custom date column.
     
    ✅ If this answer helped resolve your issue, please mark it as Accepted so it can help others with the same problem.
    👍 Feel free to Like the post if you found it useful.
     
     
  • Suggested answer
    Kalathiya Profile Picture
    1,057 Super User 2026 Season 1 on at
    Hello @Morgan_W
     
    Above approach is correct only. 

    Another way you could approach this is to sort the list first (newest to oldest) and then return the first record for each Status value. Since the list is already sorted, the first match will automatically be the most recent one.

    For example:

    You can put the following code directly into your Gallery - Items property:

    With(
        {
            _sorted: SortByColumns(SharePointListName, "Modified", SortOrder.Descending)
        },
        ForAll(
            Distinct(_sorted, Status.Value) As _status,
            LookUp(
                _sorted,
                Status.Value = _status.Value
            )
        )
    )
    
    //SharePointListName - Replace with your SharePoint list name
    //Status.Value - Status - Replace with your column name 

    Hope this helps 🙂

    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? Mention @Kalathiya anytime!
    ✔️ Don’t forget to Accept as Solution if this guidance worked for you.
    💛 Your Like motivates me to keep helping!
    ​​​​​​
  • WarrenBelz Profile Picture
    153,773 Most Valuable Professional on at
    Firstly @Kalathiya is the optimal approach - also the output of Distinct is Value, not Result - this was changed a number of years back.
     
    My main comment is that Distinct is not Delegated to SharePoint, therefore if your List size is over your Data Row Limit, you will possibly not return all of the relevant records unless there is at least one of all Status values in the first Data Row Limit records. If this is the case @Kalathiya's approach will work fine, if not, you are going to need to do something else to get all the distinct values.

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 105 Most Valuable Professional

#2
Haque Profile Picture

Haque 77

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 70

Last 30 days Overall leaderboard