cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JBennett12
Helper III
Helper III

How can I filter my choice field by the selection of another choice field?

I have multiple choice fields and I want to filter my second choice field based on the selection of the first choice field. 

Example) My first choice field would have countries (USA, Japan, Mexico, ...)  if USA is chosen it would only show the states in the US. If Japan it would show the cities only in Japan and etc. 

My second choice field contains a lot of different cities from multiple countries.

 

Thank you,

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @JBennett12 ,

Sounds like you want cascading drop-downs. Assuming some names here with a List called (for want of a better name) Sales, with Text fields called Country and Region (the second would contain either the State or City depending on the Country. Assuming your list contains less than your (500 - 2000) Delegation limit, The Items of your first drop-down (ddCountry) would be 

Sort(
   Distinct(
      Sales,
      Country
   ).Result,
   Result
)

then the Items of the second one (ddRegion) would be

Sort(
   Filter(
      Sales,
      Country = ddCountry.Selected.Result
   ).Region,
   Region
)

If you have more records than your Delegation limit, I have a workaround for the first item in this blog of mine.

 

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.

Visit my blog Practical Power Apps

View solution in original post

4 REPLIES 4
WiZey
Super User
Super User

Hello @JBennett12 ,

 

"Filter()" should solve your issue.

 

https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-filter-lookup

 

By filtering the table on the selected item of your first dropdown, you can indeed limit the second's dropdown available options.

 

Filter(Table,
  Country = FirstDropDown.Selected.Value
)

 

The code above is an example. It will filter all records in "Table", and only select records whose "Country" are equal to the selected value of the first dropdown.

 

Hope this was helpful to you.

28GREKA
Frequent Visitor

Hi! You can try something like this:

 

With a Dropdown:

28GREKA_0-1661959760021.png

Then in the ITEMS section you write a variable:

28GREKA_1-1661960042031.png

Then in a button, for example i have an icon before i show the dropdown, so in the ON SELECT section i put:

28GREKA_2-1661960216236.png

It works if you have another page to navigate and update the items in your dropdown.

 

*If you need to update the info in the same page in based on another dropdown you can check the ON CHANGE function on your first dropdown

28GREKA_3-1661960362908.png

You can create a variable with an IF where If is chosen a country then the variable contains the items you need and then put that variable on the items section from your second dropdown.

 

 

 

 

WarrenBelz
Super User
Super User

Hi @JBennett12 ,

Sounds like you want cascading drop-downs. Assuming some names here with a List called (for want of a better name) Sales, with Text fields called Country and Region (the second would contain either the State or City depending on the Country. Assuming your list contains less than your (500 - 2000) Delegation limit, The Items of your first drop-down (ddCountry) would be 

Sort(
   Distinct(
      Sales,
      Country
   ).Result,
   Result
)

then the Items of the second one (ddRegion) would be

Sort(
   Filter(
      Sales,
      Country = ddCountry.Selected.Result
   ).Region,
   Region
)

If you have more records than your Delegation limit, I have a workaround for the first item in this blog of mine.

 

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.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @JBennett12 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,965)