web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filtering Dropdown opt...
Power Apps
Unanswered

Filtering Dropdown options based on used values

(0) ShareShare
ReportReport
Posted on by 33

Hi Team, I have a small power app that displays a gallery based off a dropdown selection of the primary category it is in.

 

Not all categories are in use and I am wanting to hide the ones that aren't against an item in the list.

The Dropdown uses this FX and works but I need to add a filter to it. There is for example 50 categories but only 30 are currently assigned to items in the sharepoint list.

 

With({lclChoices: Choices('Core Tool Matrix'.'Primary Category')}, ForAll(Sequence(CountRows(lclChoices)+1), {Value: If(Value=1, "All", Last(FirstN(lclChoices,Value-1)).Value)}))

 

James_Anderson_0-1676501179873.png

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    If you want to only show the categories already assigned within your dataset as the Items in your dropdown,

    Sort(
     Distinct(
     Core Tool Matrix','Primary Category'.Value
     ),Result
    )

     

  • James_Anderson Profile Picture
    33 on at

    How do I wrap that sort/distinct around the formula already in there?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @James_Anderson 

    Try

    With({_items:ForAll(Sequence(CountRows(Choices('Core Tool Matrix'.'Primary Category'))+1), 
     {Value:If(Value=1, "All", Last(FirstN(lclChoices,Value-1)).Value)}))
     },
     Sort(Distinct(_items, Value),Result)
    )
     

     

     

  • James_Anderson Profile Picture
    33 on at

    Gave it a go, it gave an error saying "invalid number of arguements. Received 1 expected 2"

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @James_Anderson 

    Could you post a screenshot with the error message and the formula please?

  • James_Anderson Profile Picture
    33 on at

    Had to take a photo as the error on hover doesnt show if you push the screenshot shortcut keys

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @James_Anderson 

    Basically, what I did was try to create a table from your own formula in the "With" then apply Sort() and Distinct() on it. I rarely if ever work with Choice type fields, so it might not work but that is the concept. 

     

    With({_items: ForAll(Sequence(CountRows(Choices('Core Tool Matrix'.'Primary Category')+1), 
     {Value: If(Value=1, "All", 
     Last(FirstN(Choices('Core Tool Matrix'.'Primary Category'),Value-1)).Value)}))
     },
     Sort(Distinct(_items, Value),Result)
    )

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard