cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kriggo15
Responsive Resident
Responsive Resident

Convert strings in table to distinct dropdown

I have a table which shows a user's relationship to a given item. I want to look at every item and get a distinct list of the user's roles with the intent of using those in a dropdown to filter a gallery.

I'm not really sure what the logic should be. I assume I'm going to have to filter the initial table on the current user and then maybe split the relationships up and do a distinct on that?

For example, if Jim was logged in, he would have a dropdown that only includes: Leader, Owner, User, Support.

PersonItemRelationship
JimTable 1Leader, Owner
BobTable 2User, Support
SusanTable 1Owner
JimTable 3User, Support
JimTable 4Leader, Owner, Support
1 ACCEPTED SOLUTION

Accepted Solutions
rubin_boer
Super User
Super User

hi @kriggo15 

add this to your dropdown items 

Distinct(Split(Concat(Filter(YourDataSource, Person="Jim") ,Relationship,","),","),Result)

 

the example uses jim but you can replace that with a variable 

 

hope it helps

 

View solution in original post

2 REPLIES 2
rubin_boer
Super User
Super User

hi @kriggo15 

add this to your dropdown items 

Distinct(Split(Concat(Filter(YourDataSource, Person="Jim") ,Relationship,","),","),Result)

 

the example uses jim but you can replace that with a variable 

 

hope it helps

 
RandyHayes
Super User
Super User

@kriggo15 

Consider the following formula based on your data:

With({_table:
    Table(
        {Person:"Jim", Item:1, 	Relationship:"Leader, Owner"},
        {Person:"Bob", Item:2, 	Relationship:"User, Support"},
        {Person:"Susan", Item:1, 	Relationship:"Owner"},
        {Person:"Jim", Item:3, 	Relationship:"User, Support"},
        {Person:"Jim", Item:4, 	Relationship:"Leader, Owner, Support"}
    )},

    Distinct(
        Filter(
            Split(
                Concat(_table, Relationship & ", "), 
                ", "
            ),
            !IsBlank(Result)
        ),
        Result
    )
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,829)