cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DropdownHelp
Level: Powered On

Making a second dropdown dependent on a first dropdown, using an "ID" value to ensure no duplicates

I am currently trying to create several dropdown options based on a SQL-Database in PowerApps. I am having no issues with having the first Dropdown show the required information, options and default value. However, when I am trying to setup my second dropdown, and using the filter function, I am able to filter, but there are lots of duplicates in the list, making it not very pretty. I'll try to explain the problem with examples. Dropdown1 shows 'Vendor' Dropdown2 shows 'Customer' Dropdown1 Items function is Distinct('[dbo].[TableName]';Vendor) Dropdown2 Items function is Filter('[dbo].[TableName]';Dropdown1.Selected.Value in Vendor) By using the above, the same 'Customer' appreas several times under certain 'Vendors', because in the data itself, some customers have 'purchased' so to say, several times at that specific 'Vendor'. Is there a way to make it so that the duplicates go away?
1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Making a second dropdown dependent on a first dropdown, using an "ID" value to ensure

Try nesting your formula in a Distinct function, like so:

 

// Create a distinct list filtered by another combobox selection
Distinct( Filter( '[dbo].[TableName]'; Dropdown1.Selected.Value in Vendor ); Customer )

You could also put a Sort function in there if you want the list to be alphabetical. Something like this (assuming you have a column titled "Name" for your Customer table):

 

// Create a distinct list filtered by another combobox selection and sorted by name
Distinct( Sort( Filter( '[dbo].[TableName]'; Dropdown1.Selected.Value in Vendor ); Name; Ascending ); Customer )

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Making a second dropdown dependent on a first dropdown, using an "ID" value to ensure

Try nesting your formula in a Distinct function, like so:

 

// Create a distinct list filtered by another combobox selection
Distinct( Filter( '[dbo].[TableName]'; Dropdown1.Selected.Value in Vendor ); Customer )

You could also put a Sort function in there if you want the list to be alphabetical. Something like this (assuming you have a column titled "Name" for your Customer table):

 

// Create a distinct list filtered by another combobox selection and sorted by name
Distinct( Sort( Filter( '[dbo].[TableName]'; Dropdown1.Selected.Value in Vendor ); Name; Ascending ); Customer )

View solution in original post

mr-dang
Level 10

Re: Making a second dropdown dependent on a first dropdown, using an "ID" value to ensure

Adding onto @wyotim's solution, if you'd like more guidance on the topic of making one dropdown dependent on another, you can search for the terms "cascading dropdown":

 

https://www.youtube.com/results?search_query=cascading+dropdown+powerapps

Microsoft Employee
@8bitclassroom
Highlighted
Super User
Super User

Re: Making a second dropdown dependent on a first dropdown, using an "ID" value to ensure

@mr-dangGreat share! Lots of good videos (and people to follow) for more info there. 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 171 members 5,689 guests
Please welcome our newest community members: