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.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,764)