cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jbaldwin
Regular Visitor

Show Gallery Items based on Filter from another Source

Hi,

I have Table 1 (SQL) with a list of Items, say A, B, C, D and E. Then Table 2 with users associated with each of these items, e.g:

Item | User

A | Bob

C | Bob

 

Now in PowerApps I have a gallery showing Items A & C for user Bob, I want to be able to bring up a new gallery of Table 1 that shows the Items that Bob isn't a part of: B, D and E. It would be greatly appreciated if you could help me figure out a way to do this.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @jbaldwin ,

Could you show me the formula in your gallery1's Items?

Since gallery2 filters based on gallery1, so I need to know how do you set gallery1.

I assume that:

gallery1 filter based on user to only display "Bob".

gallery2 filter the items that are not in gallery1.

 

If so, try this:

gallery1's Items

Filter(table2,User="Bob")

gallery2's Items:

Filter(table1,Not(
                  Item in Filter(table2,User="Bob").Item
                  )
      )

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

3 REPLIES 3
mdevaney
Super User
Super User

@jbaldwin 

Suppose your SQL table looks like this

Item | User
A | Bob
B | Billy
C | Bob
D | Joe
E | Joe

 

And your gallery showing only Bob looks like this.

Item | User
A | Bob
C | Bob

 

Put this code in the Items property of the other gallery

Filter(your_sql_table, Item <> "Bob")

 

The result will be this

Item | User
B | Billy
D | Joe
E | Joe

 

 

---
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."

@mdevaney, Yes one of my galleries looks like:

Item | User
A | Bob
C | Bob

However I want a second gallery to look like:

Item
B
D
E 

Based on the fact that Bob is not associated with these items yet, then I will be able to select one (or more) of these items and add it to Bob's list of Items.

Hi @jbaldwin ,

Could you show me the formula in your gallery1's Items?

Since gallery2 filters based on gallery1, so I need to know how do you set gallery1.

I assume that:

gallery1 filter based on user to only display "Bob".

gallery2 filter the items that are not in gallery1.

 

If so, try this:

gallery1's Items

Filter(table2,User="Bob")

gallery2's Items:

Filter(table1,Not(
                  Item in Filter(table2,User="Bob").Item
                  )
      )

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,594)