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 / Show all using a radio...
Power Apps
Answered

Show all using a radio group and filter by current date in Gallery

(0) ShareShare
ReportReport
Posted on by 223

Good day,

I have a SharePoint list that contains records. See below.

 

a1.PNG

 

To avoid delegation, I add a clearcollect to collect the years in the SP list using the following;

 

 

ClearCollect(ProjYear,'SharePoint List')

 

 

and added a radio button (rby) putting the below code to populate the Year

 

 

Distinct(ProjYear,Year(Date1))

 

 

Also, I have added a checkbox to filter current records.

And finally, i added a Gallery (gal1) inserting the below code in the Item

 

 

Filter(
 'SharePoint List',
 Date1>= Date(
 rby.Selected.Value,
 1,
 1
 ),
 Date1<= Date(
 rby.Selected.Value,
 12,
 31
 )
)

 

 

 With this, I am able to filter the records by year. Now my question is;

 

1. I would want to be able to show all the records if no year is selected. (in the radio group).

2. Using the CheckBox, I will like to filter the current records using the Date1 Column (= or greater than today).

 

Thanks.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    Hi @caslasgee ,

    A few things here - A collection does not solve Delegation issues, just masks the problem as it too is subject to your Delegation limit. Rather than leaving a "one-time" collection hanging around, you can do this

    With(
     {wData:'SharePoint List'},
     Distinct(
     wData,
     Year(Date1)
     )
    )

    The second issue is that putting those date calculations inside a filter is not a good idea, so get them out of there and "pre-calculate" them. Combining this with your two requirements, try this

    With(
     {
     wStart: Date(rby.Selected.Value, 1, 1),
     wEnd: Date(rby.Selected.Value, 12, 31)
     },
     Filter(
     'SharePoint List',
     (
     CheckBox1.Value && 
     Date1 >= Today()
     ) ||
     (
     !CheckBox1.Value &&
     (
     Len(rby.Selected.Value) = 0 ||
     (
     Date1 >= wStart &&
     Date1 <= wEnd
     )
     )
     )
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • caslasgee Profile Picture
    223 on at

    @WarrenBelz, Thanks for the insight on how delegation works.

    I ran the code for the filter accordingly, but a portion of it gave the below error.

    cd.png

     And when i hover around the highlighted portion, It gave the below message.

    cd.png

     

    Thank you.

  • caslasgee Profile Picture
    223 on at

    @WarrenBelz, Thanks for the insight on how delegation works.

    I ran the code for the filter accordingly, but a portion of it gave the below error.

    cd.png

     And when i hover around the highlighted portion, It gave the below message.

    cd.png

     

    Thank you.

  • Verified answer
    WarrenBelz Profile Picture
    156,454 Most Valuable Professional on at

    @caslasgee ,

    Just a typo - needs && (now fixed - I thought you might ave picked that one 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

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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard