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

Distinct values on a filtered drop down

How do I combine the following so my GradYear drop down lists the grad years of the selected class only once?

 

Filter(Table_Students, Class =drpdwnClass.Selected.Value)

Distinct(Table_Students, Grad_x0020_Year)

 

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Distinct values on a filtered drop down

@ALZamora,

Ok I see.  So then the proper items property of the Year dropdown would be 

Sort(Distinct(Filter(Table_Students, Class =drpdwnClass.Selected.Value),Grad_x0020_Year),Result,Ascending) 

Powerapps functions are processed in sequence from the inside out.  The above function will filter the student table by the value of drpdwnClass first. Then the Distinct function will eliminate the duplicates. Finally the list of unique years will be sorted from oldest to newest.

How you filter your gallery is another story.

6 REPLIES 6
Super User
Super User

Re: Distinct values on a filtered drop down

Hi @ALZamora,

It appears from your screenshot that you have an Edit form that contains a card for the Grad year.  (Edit forms are used to either create or edit a single record, usually one selected from a Gallery or DataTable on another sceen. So I am assuming that you have navigated to this screen from a screen containing a Gallery.)  Inside the Grad Year card and that card contains the dropdown in question.  The Dropdown Items property should read

Sort(Distinct(Table_Students, Grad_x0020_Year), Result, Ascending)

I added the Sort so that the years in the dropdown were not listed in some chaotic order. The Update property of the Card containing the dropdown should read- drpdwnClass.Selected.Value.  Then, when you submit the form (using the check icon). The record will have the grad year chosen in the dropdown.

 

I don't see any role for Filtered on the Edit form.  However, I am assuming that you navigated to this form from a screen with a Gallery on it.  If you wanted to filter that gallery on grad year, you would have another dropdown but with a different name say (ddClassYr) on that form that has the same Items property as the one on your edit form.  (The dropdown control on the Gallery would have to have a different name  to differentiate it from the dropdown on the Edit form.) 

To filter the gallery so that only students who graduated that year are shown, you would have the Items property of the Gallery - Filter(Table_Students, Class = ddClassYr.Selected.Value)

 

Super User
Super User

Re: Distinct values on a filtered drop down

Hi @ALZamora

If this answers your issues, please mark the thread as Solved.

ALZamora
Level: Powered On

Re: Distinct values on a filtered drop down

Thank you @Drrickryp for taking the time to help me. You are correct, this form was navigated to from a Gallery.

 

The reason for the filter is that the Grad Year drop down is a part of a cascade with Class and Students. The idea is you select a Class (DS or ISP), which then filters Grad Year (2019, 20, 21 or 22 for DS; 2018 or 2019 for ISP) and after selecting the Grad Year, the Student would be filtered to only those of the selected Class and Grad Year (ex. DS 2020 or ISP 2018).

 

My issue with the Grad Year drop down is I need it filtered by the selected value of the Class drop down as well as return a distinct value of Grad Year because there's 40-80 students in each class.

Super User
Super User

Re: Distinct values on a filtered drop down

@ALZamora,

Ok I see.  So then the proper items property of the Year dropdown would be 

Sort(Distinct(Filter(Table_Students, Class =drpdwnClass.Selected.Value),Grad_x0020_Year),Result,Ascending) 

Powerapps functions are processed in sequence from the inside out.  The above function will filter the student table by the value of drpdwnClass first. Then the Distinct function will eliminate the duplicates. Finally the list of unique years will be sorted from oldest to newest.

How you filter your gallery is another story.

ALZamora
Level: Powered On

Re: Distinct values on a filtered drop down

@Drrickryp Thank you! It works perfectly! 

Super User
Super User

Re: Distinct values on a filtered drop down

Thanks and Happy Halloween.388054858_640.jpg

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 265 members 4,349 guests
Recent signins:
Please welcome our newest community members: