Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Filter table with two conditions, same column not working

Posted on by 70

I have a simple app that displays a sharepoint list in a table. I have a column in the list with the name "Title". I want to display the table filtered on if the title contains the word "Approved" or "Waiting". 

tpcolson_0-1715391314089.png

Filter('Online GIS User Account Request List', !IsMatch(Title, "approved", MatchOptions.Contains))

Works when it's one condition. 

tpcolson_1-1715391363791.png

Filter('Online GIS User Account Request List', !IsMatch(Title, "approved", MatchOptions.Contains) or !IsMatch(Title, "waiting", MatchOptions.Contains))

Does not work when I add the second condition with or

 

 

 

 

Categories:
  • Verified answer
    iAm_ManCat Profile Picture
    iAm_ManCat 1 on at
    Re: Filter table with two conditions, same column not working

    In your example. it looks like you actually want it to only show items where the Title is neither "approved" nor "waiting", so using Or won't get you that as they both allow each other - i.e. if the Title is not approved then it could be waiting or if the Title is not waiting then it could be approved - but what you want (I think) is that neither of the two appear in your datatable.

     

    Filter(
     'Online GIS User Account Request List', 
     !("approved" in Title)
     And
     !("waiting" in Title)
    )

     

    It's worth noting that this formula is not delegable though so it won't work once you are over 2000 items - so can I ask, is your Title equal to "approved" or is there other text inside the Title field? If not, and you have a limited set of potential Title values, then I would suggest using explicit references to the other possible Title names, as this is scalable and will work no matter how many options you add to it:

    Filter(
     'Online GIS User Account Request List', 
     Title="Under Review"
     Or
     Title="With Administrator"
     Or
     Title="Denied"
     Or
     Title="Rejected"
    )

     

    Cheers,

    Sancho

  • Meekou Profile Picture
    Meekou on at
    Re: Filter table with two conditions, same column not working

    Could you check for the single condition you real get expected data?

    Based on your requirement, you want to filter based on approve and waiting, but you add ! before ismatch, and for your second conditon, you should use "Or" instead of "or".

    Here is a sample demo:

     

    ClearCollect(
     SampleData,
     {
     Id: 1,
     Title: "Approved"
     },
     {
     Id: 2,
     Title: "Pending"
     },
     {
     Id: 3,
     Title: "Waiting"
     }
    );
    ClearCollect(
     FilterSampleData,
     Filter(
     SampleData,
     IsMatch(
     Title,
     "Approved",
     MatchOptions.Contains
     ) Or IsMatch(
     Title,
     "Waiting",
     MatchOptions.Contains
     )
     )
    );

     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard