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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter Gallery using c...
Power Apps
Answered

Filter Gallery using custom field

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I have created a Gallery for a SP list. On the Gallery I created a custom field to calculate a value.

I added a slider so that I can Filter the gallery based on this value. 

 

However I'm not able to use this column since it is not a field on the SP list. I tried to filter using the Gallery name and this column but still not able to figure it out. Any help

 

 

 

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

    Hi @indhaa 

     

    The column needs to be in Source data or the collection.

     

  • indhaa Profile Picture
    on at

    Hi,

     

    So my Gallery name is DetailedView and the column name is OverDueCount. This is the field you helped me with to do the calculation.

     

    This is Not a collection and NOT a SP column .

     

    So I added a Slider and want to filter based on this column.  I haven't done a filter like this before based on a custom field on a gallery and my code getting an error.

     

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @indhaa 

     

    We need to change the way OverDueCalculated.

     

    Set the Items property of Gallery to (Using Existing code that I sent)

    //DeviceOrdering
    Filter(
     AddColumns(
     DeviceOrdering,
     "OverDueCalculated",
     With(
     {
     DateRange: ForAll(
     If(
     ThisRecord.DueDate > Today(),
     Sequence(
     ThisRecord.DueDate - Today(),
     0
     ),
     Sequence(
     Today() - ThisRecord.DueDate,
     0
     )
     ),
     Weekday(
     DateAdd(
     DueDate,
     Value
     )
     )
     )
     },
     If(
     IsBlank(DueDate) || DueDate > Today(),
     0,
     DateDiff(
     DueDate,/* Start Date */
     Today()/* End Date */
     ) - CountRows(
     Filter(
     colHoliday,
     HolidayDate >= DueDate,
     HolidayDate <= Today()
     )
     ) - CountRows(
     Filter(
     DateRange,
     Value = 6
     )
     ) - CountRows(
     Filter(
     DateRange,
     Value = 7
     )
     )
     )
     )
     ),
     OverDueCalculated < Slider1.Value
    )

     

    in the gallery Set the Text property of OverDue Label control to

    ThisItem.OverDueCalculated

     

    Note: Change the SliderName (Slider1)

  • indhaa Profile Picture
    on at

    Hi Stalin,

     

    Thanks for your help

     

    I need a little help. Already I have other filtering in the gallery. When I try to amend it with the overdue code you provided I'm getting an error. With only the Overdue filter it is working but when I try to combine I'm having a issue. Below is the code I'm trying to combine

    SortByColumns(
     Filter(
     DeviceOrdering, 
     StartsWith(RequestTitle, TitleFilterInput.Text) &&
     RequesterDepartment = RequesterDeptFilterInput.Selected.Result &&
     Priority.Value = PriorityFilterInput.Selected.Value 					
     ), "ID", Descending)

     

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

    Hi @indhaa 

     

    With(
     {
     _item: AddColumns(
     DeviceOrdering,
     "OverDueCalculated",
     With(
     {
     DateRange: ForAll(
     If(
     ThisRecord.DueDate > Today(),
     Sequence(
     ThisRecord.DueDate - Today(),
     0
     ),
     Sequence(
     Today() - ThisRecord.DueDate,
     0
     )
     ),
     Weekday(
     DateAdd(
     DueDate,
     Value
     )
     )
     )
     },
     If(
     IsBlank(DueDate) || DueDate > Today(),
     0,
     DateDiff(
     DueDate,/* Start Date */
     Today()/* End Date */
     ) - CountRows(
     Filter(
     colHoliday,
     HolidayDate >= DueDate,
     HolidayDate <= Today()
     )
     ) - CountRows(
     Filter(
     DateRange,
     Value = 6
     )
     ) - CountRows(
     Filter(
     DateRange,
     Value = 7
     )
     )
     )
     )
     )
     },
     SortByColumns(
     Filter(
     _item,
     OverDueCalculated < Slider1.Value && StartsWith(
     Title,
     TitleFilterInput.Text) &&
     RequesterDepartment = RequesterDeptFilterInput.Selected.Result &&
     Priority.Value = PriorityFilterInput.Selected.Value 
     ),
     "ID",
     Descending
     )
    )

     

    I assumed other filter already working

    && StartsWith(Title,TitleFilterInput.Text) &&
    RequesterDepartment = RequesterDeptFilterInput.Selected.Result &&
    Priority.Value = PriorityFilterInput.Selected.Value

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard