web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Help with a Filter Query
Power Apps
Answered

Help with a Filter Query

(0) ShareShare
ReportReport
Posted on by 716 Moderator

This isn't just a PowerApps question, I just happen to be doing the query in PowerApps so I'm here asking for help.

 

I have an existing filter condition for a gallery that is working. I'd like to add an additional condition and can't figure out the logic on my own. I know what I want to do, I just can't write the code.

 

Current Filter:

 

Filter(
 'SPIFF - Requests',
 (galFilter.Selected.Value = "All" || Status.Value = galFilter.Selected.Value) &&
 Approval_Level = LookUp('SPIFF - Approvers', User().Email = Approver.Email, Approve_Level)
 )

 

 

What I want/need to add is an additional condition.

I want to check for records in 'SPIFF - Approvals' related to the Items returned for the current user. In other words, only show Requests if the users approval level matches the approval level as above AND there are 0 records in 'SPIFF - Approvals' for the request created by the current user. The approvals table holds the Request ID in a field name PositionID.

 

Here is my attempt which I think is pretty close but is returning no records and I can't figure out how to correct the filter statement.

 

Filter(
 'SPIFF - Requests',
 (galFilter.Selected.Value = "All" || Status.Value = galFilter.Selected.Value) &&
 Approval_Level = LookUp('SPIFF - Approvers', User().Email = Approver.Email, Approve_Level) &&
 (CountIf('SPIFF - Approvals', Approver.Email = User().Email && Status.Value = "Approved") = 0)
 )

 

Thank you in advance to the good samaritan who comes to my rescue.

Categories:
I have the same question (0)
  • DCHammer Profile Picture
    716 Moderator on at

    I figured it out. I had my CountIf logic backwards. I needed to check if <>0. 

     

    Yeah, that wasn't true. I'm leaving this open.

  • Verified answer
    DCHammer Profile Picture
    716 Moderator on at

    Got it.

     

    Filter(
     'SPIFF - Requests',
     (galFilter.Selected.Value = "All" || Status.Value = galFilter.Selected.Value) && Approval_Level = LookUp(
     'SPIFF - Approvers',
     User().Email = Approver.Email,
     Approve_Level
     ) && !(ID in Filter(
     'SPIFF - Approvals',
     Approver.Email = User().Email && Status.Value = "Approved" && Approver.Email = User().Email
     ).PositionID)
     )

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 490

#2
WarrenBelz Profile Picture

WarrenBelz 427 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 381

Last 30 days Overall leaderboard