cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Get only distinct values in combo box

Is there any way to show only distinct values in Combo box?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Get only distinct values in combo box

Hi @Maheshwari ,

Could you please share more details about the formula you typed within the Items property of the ComboBox?

 

Based on the needs that you mentioned, please consider take a try with the following workaround:

Set the Items property of the ComboBox to following:

Distinct('Your DataSource', ColumnName).Result

If the ColumnName is a Choice type column, please modify above formula as below:

Distinct('Your DataSource', ColumnName.Value).Result

 

In addition, I also think GroupBy function could also achieve your needs. Please set the Items property of the ComboBox to following:

GroupBy('Your DataSource', "ColumnName", "GroupData")

then specify the "ColumnName" as Display column value within the ComboBox.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
Highlighted
Super User
Super User

Re: Get only distinct values in combo box

@Maheshwari 

Yes, you can do this by using the DISTINCT function in the Items property of the ComboBox.

 

Distinct(your_datasource_name, your_column_name)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Super User
Super User

Re: Get only distinct values in combo box

On the Items of the combobox put:

Distinct (Datasource,ColumnName)

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Highlighted
Frequent Visitor

Re: Get only distinct values in combo box

yes I have already tried that ,but it doesnot work,it displays only empty tabs.

but it works with dropdown

Highlighted
Super User
Super User

Re: Get only distinct values in combo box

@Maheshwari 
You need to also define the DisplayFields and SearchFields properties like this:

 

["your_column_name"]

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Frequent Visitor

Re: Get only distinct values in combo box

Already tried it..but doesnt work

 

Highlighted
Super User
Super User

Re: Get only distinct values in combo box

@Maheshwari 

You'll need to supply more information about the data you used DISTINCT on.  Can you please put this code in the OnSelect property of a new button and then post a screenshot of what the resulting collection looks like?

ClearCollect(colTest, Distinct(my_datasource, my_column))

 

Another idea is to use this code in DisplayMode

["Result"]

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

Highlighted
Community Support
Community Support

Re: Get only distinct values in combo box

Hi @Maheshwari ,

Could you please share more details about the formula you typed within the Items property of the ComboBox?

 

Based on the needs that you mentioned, please consider take a try with the following workaround:

Set the Items property of the ComboBox to following:

Distinct('Your DataSource', ColumnName).Result

If the ColumnName is a Choice type column, please modify above formula as below:

Distinct('Your DataSource', ColumnName.Value).Result

 

In addition, I also think GroupBy function could also achieve your needs. Please set the Items property of the ComboBox to following:

GroupBy('Your DataSource', "ColumnName", "GroupData")

then specify the "ColumnName" as Display column value within the ComboBox.

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: Get only distinct values in combo box

Thank you so much. This really helped me to think over another solution.

 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,524)