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 / Filter Gallery on Crea...
Power Apps
Answered

Filter Gallery on Created Date on Choice Field

(0) ShareShare
ReportReport
Posted on by 83

I have a SharePoint list with a choice column called "Employee" and a Date/Time column called "SubDate"

 

Is it possible to filter the gallery so it only shows the employee only once based on the most recent create date?

 

EmployeeDate
  Tim  9/1
  Mary  9/5
  Joe  9/8
  Tim  9/5
  Mary  9/1

 

I would like the gallery to show:

EmployeeDate
  Tim  9/5
  Mary  9/5
  Joe  9/8
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,926 Most Valuable Professional on at

    Hi @ttaylor4125 ,

    This should do it - note the Choice field is making this more complex than if you used a Text field.

    AddColumns(
     GroupBy(
     AddColumns( 
     YourListName,
     "EmpName",
     Employee.Value
     ),
     "EmpName",
     "Data"
     ),
     "NewDate",
     First(
     Sort(
     Data,
     SubDate,
     Descending
     )
     ).SubDate
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • ttaylor4125 Profile Picture
    83 on at

    Thank you! This worked except it starts with a 9/13/2021 date, goes to 9/10/2021, 9/8/2021, etc. but ends with a 9/13/2021 date. Weird!?

     

    And I probably complicated things more because I am building of this gallery to create another gallery (Gallery2) that shows the notes. I used enhanced text so, as an example, one of my boxes on Gallery2 is HtmlText = ThisItem.Career. It was working until I added the fix you suggested; now I'm getting the red X's for each of the items in Gallery2. 

     

    Also, where would I put the sort on the original Gallery to it's alphabetical? Sorry to be such a pain. 

  • WarrenBelz Profile Picture
    154,926 Most Valuable Professional on at

    @ttaylor4125 ,

    Sort on the gallery you posted by name would be

    Sort(
     AddColumns(
     GroupBy(
     AddColumns( 
     YourListName,
     "EmpName",
     Employee.Value
     ),
     "EmpName",
     "Data"
     ),
     "NewDate",
     First(
     Sort(
     Data,
     SubDate,
     Descending
     )
     ).SubDate
     ),
     EmpName
    )

    I do not fully understand the issue with the date sort (the final result is not sorted by date, but rather shows the newest date on each item).

    The problem with the Notes is there are more than one Notes field per item, so unless you want the second gallery to have the Items 

    Gallery1Name.Selected.Data

    where you could display all the records belonging to the selected group in the first gallery. 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • ttaylor4125 Profile Picture
    83 on at

    Thank you for all your help. I've attached a couple edited screen shots.

     

    1. Current  View before grouping file: Showing every time an employee submits a report. Gallery2 on the right is populating correctly when a date is chosen from Gallery1 on the left. However, I only want the most current report for each employee in Gallery1 so supervisors aren't having to go through the list to find each employees most recent report.

     

    2. Error in Notes Field file: After I group the employees, I'm getting errors in the HtmlText boxes in Gallery2 on the right - and the Submission Date in Gallery1 on the left is no longer clickable. 

     

    Thanks again for all your help! It's much appreciated. 

    Error in Notes Field.jpg
    Current View before grouping.jpg
  • WarrenBelz Profile Picture
    154,926 Most Valuable Professional on at

    @ttaylor4125 ,

    Wat are the Items of the second gallery and what is the HtmlText  of the Notes field?

  • ttaylor4125 Profile Picture
    83 on at

    Items of Gallery2 = Gallery1.Selected

     

    HtmlText=ThisItem.Goals (It's different for each of the boxes, so I also have ThisItem.Progress; ThisItem.Barriers; ThisItems.Learnings).

     

    Thank you!!!

  • WarrenBelz Profile Picture
    154,926 Most Valuable Professional on at

    @ttaylor4125 ,

    It needs to refer to the Data group (if you used my wording)

    Gallery1.Selected.Data

    it will then show all the notes for the Selected Employee

  • ttaylor4125 Profile Picture
    83 on at

    That's what I originally had but they only wanted to see notes for that one week - not all the other notes. 

  • ttaylor4125 Profile Picture
    83 on at

    I actually have a different button for supervisors to see past reports where they choose the employees name from a drop down. Then I have a gallery that shows all the dates for that employee and they can click on a date to view the notes. What they are wanting is a button to see just this week's reports from all the employees. I hope that makes sense.

  • WarrenBelz Profile Picture
    154,926 Most Valuable Professional on at

    @ttaylor4125 ,

    Then you need to do this

    Sort(
     AddColumns(
     GroupBy(
     AddColumns( 
     YourListName,
     "EmpName",
     Employee.Value
     ),
     "EmpName",
     "Data"
     ),
     "NewDate",
     First(
     Sort(
     Data,
     SubDate,
     Descending
     )
     ).SubDate,
     "WeekNotes",
     First(
     Sort(
     Data,
     SubDate,
     Descending
     )
     ).Notes
     ),
     EmpName
    )

    and the second one does not need to be a Gallery - it can just be a HTML Box with 

    Gallery1.Selected.WeekNotes

    or are you wanting all the notes from everyone in the second gallery?

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard