cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Marie_Claire_
Level: Powered On

Filter Gallery using multiple condition

Hi,

 

I am trying to filter a gallery using 2 condition, first condition is based on ticket assignment and the second condition is based on ticket status. Currently, I am using the filter based on 2nd condition (it's working fine) however I cannot figure out the correct formula to concatenante both condition.

 

Hoping someone can help me out.

 

Thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Filter Gallery using multiple condition

Hi @Marie_Claire_,

 

The "Duplicate names" means that there are duplicate names within the Table1 data source. 

 

On your side, you should type the following formula within the Items property of the Gallery control:

 

Filter(
    AddColumns(
Ticket,
"UserAccess",
LookUp(Project,ProjectID_T5=Ticket[@ProID],UserAccess)
), UserAccess=UserDisplayName, BR_Stat.Value=StatusValue )

More details about AddColumns function, please check the following article:

AddColumns

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
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

15 REPLIES 15
Dawidvh
Level 10

Re: Filter Gallery using multiple condition

Hi @Marie_Claire_

 

Make sure that both work when used individually, to make sure that the data and formual is 100%. Once you can confirm that both work, you should be able to combine them into one Filter command. You don't have to concatenate the conditions, you can simply specify both as filters

 

Filter(CollectionName,value1="Yes",value2="Yes")

 

If you don't come right, please share the formula you are using to see if I can help.

 

BrianKnight
Level 8

Re: Filter Gallery using multiple condition

Hi @Marie_Claire_you'll want to seperate your two conditions with either an && (and condition) or || (or condition) like below:

 

Filter('Culture Shoutouts',Culture_x0020_Category="Deliver Gifts"||Culture_x0020_Category="Deliver Wow")

 

Brian

Marie_Claire_
Level: Powered On

Re: Filter Gallery using multiple condition

Hi @Dawidvh and @BrianKnight, the conditions are from different Sharepoint List.

 

Condition 1:

Filter(Project, Assigned_To=User().DisplayName)

Condition 2:

Filter(Ticket,Status.Value=StatusValue)

 

I am looking on how I can filter the gallery using both conditions.

 

Thanks in advance.

Dawidvh
Level 10

Re: Filter Gallery using multiple condition

Hi @Marie_Claire_,

 

Thank you  for the info.

 

a) What are you planning to display in the gallery, tickets or projects, or both?

b) Are you busy building a task list to show all items that are currently assigned to a specific person?

c) Do these lists share similar columns? 

d) How much data do you expect from both of these lists's filter results?

 

Based on many assumptions, it might make sense to Collect the results from these filterred lists into a collection, and then display the collection into a gallery.

Marie_Claire_
Level: Powered On

Re: Filter Gallery using multiple condition

Hi @Dawidvh,

 

a) What are you planning to display in the gallery, tickets or projects, or both?

    * the gallery should diplay the tickets (please note that for every project there will be multiple tickets).

 

b) Are you busy building a task list to show all items that are currently assigned to a specific person?

     * Yes, gallery should show all the items currently assigned to a specific person but it should be filetered by status.

 

c) Do these lists share similar columns? 

     *  Yes, They have similar colums like Project Title and Project ID

 

d) How much data do you expect from both of these lists's filter results?

     * what we are is expecting might be below 50 tickets per project.

 

Really appreciate the help. Smiley Happy

BrianKnight
Level 8

Re: Filter Gallery using multiple condition

Hi @Marie_Claire_, it feels like the optimal way to display this would be nested galeries. The left one could show a list of projects (or it could be a drop-down box if you'd prefer).  Since ProjectID is shared between the Project and Ticket lists, you can concatenate the search criteria. 

 

This video will show you how to nest the galleries: Nesting PowerApps Galleries using a very similar example to you with Projects to timecards and should get you close. Here's what the code might look like since you have a shared ProjectID:

 

//Change User().DisplayName to a variable called varUserDisplayName to remove delegation warnings. You can do this onVisible or onStart.

Filter(Ticket, ProjectID=galProjectBrowse.selected.ProjectID&&Status.Value=DropDownStatus.Selected.Value)


//I'm assuming StatusValue is a drop-down selector to show Active or Dead projects

I'm making huge assumptions in that code. Mainly, that you have a previous gallery called galProjectBrowse to show a list of projects. In that gallery, you can apply your filter to only show projects you have rights to with your Filter(Project, Assigned_To=User().DisplayName) code. Then, you can see a list of tickets for that given project by status next. 

 

 

 

 

 

Marie_Claire_
Level: Powered On

Re: Filter Gallery using multiple condition

Hi @BrianKnight,

 

The picture below is similar with the one I'm currently working with. Once the User select a "Status" it will  filter the gallery, however I need to filter it also with "Assigned to". The Items showing in the gallery is SP List for Tickets while the "Assigned to" is maintained in SP for Projects.  

 

Capture.PNG

BrianKnight
Level 8

Re: Filter Gallery using multiple condition

OK that's helpful! I would put the top items into a gallery of their own with a GroupBy clause to keep that part simple. 

 

 

Filter('[dbo].[TimeCard]',ProjectID=
LookUp('[dbo].[Project]',StatusReportEmail=varCurrentUser,ProjectID)&&
Status=galStatusTopArea.Selected.StatusID)

I just tested this and it will meet your needs. The only challenge is it will cause delegation warnings, limiting you to no more than 2k rows (after you change the default property) because there's a lookup inside a Filter. That's why your best bet might be to narrow down the project list as part of  an onVisible or OnStart. Or have a gallery of projects as I mentioned above to pre-filter things down a bit. If you do that, you'll be golden. 

 

Hope that helps. 

 

Marie_Claire_
Level: Powered On

Re: Filter Gallery using multiple condition

Hi @BrianKnight,

 

It's working now, however the gallery doesnt show the exact count of ticket for a particular status. 

Filter('Ticket', ProID=LookUp(Project, UserAccess=UserDisplayName, ProjectID_T5)&&BR_Stat.Value=StatusValue)

 

 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 414 members 4,545 guests
Please welcome our newest community members: