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 / Filtering a Gallery us...
Power Apps
Answered

Filtering a Gallery using radio buttons - need help with the logic

(0) ShareShare
ReportReport
Posted on by 1,393

I have a gallery of devices (laptops, desktop PCs, etc.) that I want to present to users. There are two criteria that they may use (independently or together) to filter the gallery: Platform (Mac OS X or Windows) and Type (All-in-One, Desktop or Laptop/Tablet). Each criteria has a radio button that by default is blank but may be set to any one of the available choices. 

 

Here is the current formula I'm using:

SortByColumns(Filter(colCurrentDevices,radioPlatform.Selected.Value in 'Operating System'.Value && radioDevType.Selected.Value in 'Device Type'.Value),"DeviceBaseCost",Ascending,"Title",Ascending)

I know that I need some kind of nesting logic in there to adjust what's displayed based on whether they've made a choice in the radio buttons or not, but I'm just spinning my wheels trying to figure it out. 

 

Basically, with the radio buttons blank (no value selected on either), I want to display all of the devices. With one or the other, or both selected, the view should narrow down to only those devices meeting the selected criteria. 

Categories:
I have the same question (0)
  • Verified answer
    Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    Here is my attempt at the formula. I am doing this freehand, so there may be some typos.

     

    SortByColumns(
    If(
     If(!IsBlank(radioPlatform.Selected.Value) && !IsBlank(radioDevType.Selected.Value),
    	Filter(colCurrentDevices,radioPlatform.Selected.Value in 'Operating System'.Value, radioDevType.Selected.Value in 'Device Type'.Value),
    	If(!IsBlank(radioPlatform.Selected.Value),
    	 Filter(colCurrentDevices,radioPlatform.Selected.Value in 'Operating System'.Value),
    	 If(!IsBlank(radioDevType.Selected.Value),
    	 Filter(colCurrentDevices,radioDevType.Selected.Value in 'Device Type),
    		colCurrentDevices
    	 )
    	)
     )
    ),
    "DeviceBaseCost",Ascending,"Title",Ascending) 
  • ChadVKealey Profile Picture
    1,393 on at

    @Jeff_Thorpe , that was almost perfect, but had an extra If in there and was missing a closing '. What I ended up with (which works exactly as I need it to) is:

     

    SortByColumns(
    
     If(!IsBlank(radioPlatform.Selected.Value) && !IsBlank(radioDevType.Selected.Value),
    	Filter(colStandardDevices,radioPlatform.Selected.Value in 'Operating System'.Value, radioDevType.Selected.Value in 'Device Type'.Value),
    	If(!IsBlank(radioPlatform.Selected.Value),
    	 Filter(colStandardDevices,radioPlatform.Selected.Value in 'Operating System'.Value),
    	 If(!IsBlank(radioDevType.Selected.Value),
    	 Filter(colStandardDevices,radioDevType.Selected.Value in 'Device Type'.Value),colStandardDevices
    	 )
    	)
     ),
    "DeviceBaseCost",Ascending,"Title",Ascending)

    Note: I changed the collection name to "colStandardDevices" because I ended up splitting them into two galleries (Standard Devices and Premium Devices) for clarity within the App.

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

#2
11manish Profile Picture

11manish 203 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard