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 / Groupby gallery on Sta...
Power Apps
Unanswered

Groupby gallery on Status column (Open,InProgress,Closed) and within each category return the record which has max timestamp value

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I am trying to build a PowerApp in which I want to create actions based on activities. I have two tables (1) Log Data and (2) Actions. The linking pin between the two tables is a column called TaskKey. TaskKey is the primary key in LogData and the foreign key in Actions.

 

On my homescreen I have a gallery (gallery1) sourced from Log Data (Items = sharepoint source). The log data lists a number of activities with some additional fields (not relevant for my problem). To the right of this log data gallery I have a second gallery (gallery2) with items set to gallery1.selected. I have a nested gallery (nested_gallery) inside gallery2 in which I have set the items to:

 

 

Filter(
 Sort(
 Sort(
 'Action Sample Data',
 CreationDate,
 Descending
 ),
 Status.Value,
 Descending
 ),
 TaskKey = ThisItem.TaskKey
)

 

 

This will then allow me to create actions based on a certain activity from the log gallery. The nested_gallery looks like this:

nested gal.png

What I want to achieve is the following: in my nested_gallery I only want to show the grouped values on Status. So I want to see 1 open, 1 inProgress and 1 closed record. The record shown should be the latest created record in each group (timestamp col).

 

Does anyone know what I need to change to achieve this? The Status column in sharepoint is stored as Choice type.

 

Thanks in advance!

Categories:
I have the same question (0)
  • rubin_boer Profile Picture
    4,843 Super User 2024 Season 1 on at

    hi @hello123_1 

     

    Welcome to the community!

     

    You can achieve this with a single gallery:

    1. Step 1: grouped your data by the status colums
    2. Step 2: add a column to the grouped data, finding the maximum in that column.

    Example:

    A data source has the columns, id | tdate | 'status value', lets call this datasource colGroupedBy

    Data source added to a gallery, Items = Sort(colGroupedBy, tdate, Descending)

    rubin_boer_0-1677326727380.png

     

    Now step 1, group the data

    Add another gallery and set the items to the formula below.

    The following formula will group the data by status, GroupBy(colGroupedBy, "status value" ,"Grouped Status")

     

    replace the Items formula with the formula below

    In step 2 lets add a column to the grouped data in step 1, AddColumns(GroupBy(colGroupedBy,"Status Value","Grouped Status"), "Latest Date", Max('Grouped Status',tdate))

     

    Grouped data

    rubin_boer_1-1677327734739.png

     

    Canvas Edit

    grouped data.gif

     

     

     

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard