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 / Limit Dropdown to only...
Power Apps
Answered

Limit Dropdown to only show what's already been filtered

(0) ShareShare
ReportReport
Posted on by 49

Hi I have a data table that needs to get filtered on by multiple different dropdowns. Right now I have it setup so that all the filters work correctly, but it will always filter on all. What I want it to do is if I use one filter and 10 results come back, then use another filter, I want that second filter to only show me what's available from the pre filtered 10 results. 

 

Example:

I first pick a category dropdown: boots

The next dropdown is color and boots only have colors red and blue while shoes category have colors yellow and green

Right now if I go choose boots on the first dropdown and then go to the second dropdown it will show all colors: red, blue, green, yellow. What I want is for it to take the first filter and apply it to the second so that it will only show red and blue if I pick boots. 

 

This is the code I have currently for the items property of my data table:

 

Search(Filter('[dbo].[970_item_format_item_mast]',
(part_name = Gallery4.Selected.'Part Name') &&
(outerdd.Selected.Result = 0 || outer_diameter = outerdd.Selected.Result) &&
(innerdd.Selected.Result = 0 || inner_diameter = innerdd.Selected.Result) &&
(cross_sectiondd.Selected.Result = 0 || cross_section = cross_sectiondd.Selected.Result) &&
(Heightdropd.Selected.Result = " - " || height = Heightdropd.Selected.Result) &&
(mat_compounddd.Selected.Result = " - " || material_compound = mat_compounddd.Selected.Result) &&
(mat_compound_familydd.Selected.Result = " - " || material_family = mat_compound_familydd.Selected.Result) &&
(mat_manufacturerdd.Selected.Result = " - " || material_manufacturer = mat_manufacturerdd.Selected.Result) &&
(material_supplieriddd.Selected.Result = " - " || material_man_supplier_id = material_supplieriddd.Selected.Result)),'Part Number/Description Searchbox'.Text,"item_id","item_desc")

 

 This is what I have setup for the onvisible property of that screen

 

ClearCollect(Parent_Cat, {Result: " - "});
Collect(Parent_Cat, Distinct('[dbo].[970_item_format_item_mast]',parent_category));
ClearCollect(Sub_Cat, {Result: " - "});
Collect(Sub_Cat, Sort(Distinct('[dbo].[970_item_format_item_mast]',sub_category),Result,Ascending));
ClearCollect(Out_Diam, {Result: 0});
Collect(Out_Diam, Sort(Distinct('[dbo].[970_item_format_item_mast]'.outer_diameter,outer_diameter),Result,Ascending));
ClearCollect(In_Diam, {Result: 0});
Collect(In_Diam, Sort(Distinct('[dbo].[970_item_format_item_mast]'.inner_diameter,inner_diameter),Result,Ascending));
ClearCollect(Cross, {Result: 0});
Collect(Cross, Sort(Distinct('[dbo].[970_item_format_item_mast]'.cross_section,cross_section),Result,Ascending));
ClearCollect(colheight, {Result: " - "});
Collect(colheight, Sort(Distinct('[dbo].[970_item_format_item_mast]'.height,height),Result,Ascending));
ClearCollect(colmat_compound, {Result: " - "});
Collect(colmat_compound, Sort(Distinct('[dbo].[970_item_format_item_mast]'.material_compound,material_compound),Result,Ascending));
ClearCollect(colmat_fam, {Result: " - "});
Collect(colmat_fam, Sort(Distinct('[dbo].[970_item_format_item_mast]'.material_family,material_family),Result,Ascending));
ClearCollect(colmat_man, {Result: " - "});
Collect(colmat_man, Sort(Distinct('[dbo].[970_item_format_item_mast]'.material_manufacturer,material_manufacturer),Result,Ascending));
ClearCollect(colmat_supid, {Result: " - "});
Collect(colmat_supid, Sort(Distinct('[dbo].[970_item_format_item_mast]'.material_man_supplier_id,material_man_supplier_id),Result,Ascending))

 

Categories:
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Techgallagher ,

    Does your first Dropdown box connect to the Parent_Cat collection? Does your second Dropdown box connect to the Sub_Cat Collection?

    Regarding the needs that you mentioned, I have made a test on my side, please try the following workaround:

    Set the Items property of the first Dropdown box to following:

    Parent_Cat

     

    Set the Items property of the second Dropdown box to following:

    Filter(
     Sub_Cat,
     If(
     Dropdown1.Selected.Result = " - ",
     true,
     Result in Filter('[dbo].[970_item_format_item_mast]', parent_category = Dropdown1.Selected.Result).sub_category
     )
    )

     

    Please try above solution, then check if the issue is solved.

     

    Regards,

  • Techgallagher Profile Picture
    49 on at

    Hi, Sorry for the late reply, but thank you so much for this answer! I tested it in my application and it works; however, there are some bug issues that I'm not sure why it is happening. So I used the formula you provided and updated the context for the outer diameter and inner diameter dropdowns and it works when I go from filtering right to left starting at inner diameter; however, if I choose a filter randomly or start from left to right (starting at parent category dropdown) then the sub category drop down and the inner and outer diameter dropdowns get filtered automatically with a random number/ subcategory. Additionally if I use my clear filter button, if I filter from right to left it works fine but then if I filter from left to right or randomly, then it just doesn't clear the filters. So basically if I filter from right to left it will work, but if I try any other order it will fail. 

     

    This is your formula just modified to match the outer diameter dropdown

    Filter(
     Out_Diam,
     If(
     Sub_Cat_dd.Selected.Result = " - ",
     true,
     Result in Filter('[dbo].[970_item_format_item_mast]', sub_category = Sub_Cat_dd.Selected.Result).outer_diameter
     )
    )

     This is what the screen looks like

    Techgallagher_0-1599661662987.png

    And As far as the clear filters button goes, it will just toggle the reset property variable true on each dropdown

    UpdateContext({filterOn:!true});
    Set(resetsearch,true);
    Set(resetpardd,true);
    Set(resetsubdd,true);
    Set(resetoutdd,true);
    Set(resetindd, true);
    Set(resetcross, true);
    Set(resetheightdd,true);
    Set(resetmatcompound,true);
    Set(resetmatfam,true);
    Set(resetmatman,true);
    Set(resetmatsupid,true)
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Techgallagher ,

    Regarding the issue that you mentioned, I think it is another issue, which is separated with your original issue. If the solution I provided above could fix your original issue (Parent Category Dropdown and Sub Category Dropdown), please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

     

    If you also want to filter your Outer Diameter Dropdown box based on the selected option within your Sub Category Dropdown box, I think there is something wrong with your formula. Please consider modify your formula as below:

    Set the Items property of the Outer Diameter Dropdown box to following:

    Filter(
     Out_Diam,
     Result in Filter(
     '[dbo].[970_item_format_item_mast]',
     If(
     Parent_Cat_dd.Selected.Result = " - ",
     true,
     parent_category = Parent_Cat_dd.Selected.Result
     ),
     If(
     Sub_Cat_dd.Selected.Result = " - ",
     true,
     sub_category = Sub_Cat_dd.Selected.Result
     )
     ).outer_diameter
    )

     

    Please try above solution, then check if the issue is solved.

     

    Regards,

  • Techgallagher Profile Picture
    49 on at

    Hi, thank you for replying to my response and thank you for taking the time to help me out with this. Unfortunately, that is not what I was originally asking about. What I need is for the dropdown choices to be limited once one of the other filters have been picked. As of now it will always just show all the options from any dropdown even if one of the filters is already applied. So for example say for the subcategory I choose RG and RG's subcategory should only have two options of inner diameter: 1 or 2. As of now if I were to choose RG as the subcategory then go to choose the inner diameter from the dropdown it will show me all the options for inner diameter, not just the two actually available. Please refer to my color example too in the original post, and let me know if you are confused because I know it can be confusing sometimes. 

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard