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 / Power Apps Formula - O...
Power Apps
Unanswered

Power Apps Formula - Or Formula acting as if it is an And formula

(0) ShareShare
ReportReport
Posted on by 4

I have a formula that is using the OR command, but the results that I'm getting back are using it as if it is the AND command.

 

In the formula below, I am trying to filter my results to those cases where Q_6A_comments OR Q_12A_comments OR Q_10A_comments OR Q_9A_2016_comments are not blank.  What I get are cases where all four are not blank.  What am I doing wrong?

 

 

If(
MayPublishComments.Value = true And NotReviewed.Value = true,
Sort(
Filter(
'AtNeed Complete v2S',
Or(
!IsBlank(Q_6A_Comments),
!IsBlank(Q_12A_Comments),
!IsBlank(Q_10A_Comments),
!IsBlank(Q_9A_2016_Comments)
) And Q_12C_Flag = 1 And IsBlank('Marketing Used ')
),
DateFormReceived,
Descending
),
If(
MayPublishComments.Value = true And NotReviewed.Value = false,
Sort(
Filter(
'AtNeed Complete v2S',
Q_12C_Flag = 1 And Or(
!IsBlank(Q_6A_Comments),
!IsBlank(Q_12A_Comments),
!IsBlank(Q_10A_Comments),
!IsBlank(Q_9A_2016_Comments)
)
),
DateFormReceived,
Descending
),
If(
MayPublishComments.Value = false And NotReviewed.Value = true,
Sort(
Filter(
'AtNeed Complete v2S',
IsBlank('Marketing Used ') And Or(
!IsBlank(Q_6A_Comments),
!IsBlank(Q_12A_Comments),
!IsBlank(Q_10A_Comments),
!IsBlank(Q_9A_2016_Comments)
)
),
DateFormReceived,
Descending
),
Sort(
Filter(
'AtNeed Complete v2S',
Or(
!IsBlank(Q_6A_Comments),
!IsBlank(Q_12A_Comments),
!IsBlank(Q_10A_Comments),
!IsBlank(Q_9A_2016_Comments)
)
),
DateFormReceived,
Descending
)
)
)
)

Categories:
  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @RPeck ,

    Can you please (if you have not already) use Format Text and paste your code in a text box as below (the </> icon above)

    Code in here

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @RPeck :

    I think the logic of this code

    Or(
    !IsBlank(Q_6A_Comments),
    !IsBlank(Q_12A_Comments),
    !IsBlank(Q_10A_Comments),
    !IsBlank(Q_9A_2016_Comments)
    )

    has already met your requirements:

    I am trying to filter my results to those cases where Q_6A_comments OR Q_12A_comments OR Q_10A_comments OR Q_9A_2016_comments are not blank.

    I think this link will help you a lot:

    Operators and Identifiers in Power Apps

    In addition, I suggest you check your data source and other filter rules. Whether these 4 fields in records that meet other filter rules are all not blank?

    Please try this code, is the running result the same as before?( Delete all OR (……), if the result is unchanged then there is no issue in OR (……))

    If(
    MayPublishComments.Value = true And NotReviewed.Value = true,
    Sort(
    Filter(
    'AtNeed Complete v2S',
    Q_12C_Flag = 1 And IsBlank('Marketing Used ')
    ),
    DateFormReceived,
    Descending
    ),
    If(
    MayPublishComments.Value = true And NotReviewed.Value = false,
    Sort(
    Filter(
    'AtNeed Complete v2S',
    Q_12C_Flag = 1 
    ),
    DateFormReceived,
    Descending
    ),
    If(
    MayPublishComments.Value = false And NotReviewed.Value = true,
    Sort(
    Filter(
    'AtNeed Complete v2S',
    IsBlank('Marketing Used ') 
    )
    ),
    DateFormReceived,
    Descending
    ),
    Sort(
    'AtNeed Complete v2S',
    DateFormReceived,
    Descending
    )
    )
    )
    )

    Best Regards,

    Bof

     

  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @RPeck  and thank you @v-bofeng-msft for the summary.

    The reason I wanted formatted text was to save me a bit of time suggesting something different - it is below and should do what you need. I free-typed it, so I hope all the commas and brackets are correct. 

    With(
     {
     bComm:
     Or(
     !IsBlank(Q_6A_Comments),
     !IsBlank(Q_12A_Comments),
     !IsBlank(Q_10A_Comments),
     !IsBlank(Q_9A_2016_Comments)
     ),
     PubRev: MayPublishComments.Value = true And NotReviewed.Value = true,
     PubNoRev: MayPublishComments.Value = true And NotReviewed.Value = false,
     NoPubRev: MayPublishComments.Value = false And NotReviewed.Value = true
     },
     Sort(
     Filter(
     'AtNeed Complete v2S',
     If(
     PubRev,
     bComm And Q_12C_Flag = 1 And IsBlank('Marketing Used '),
     PubNoRev,
     Q_12C_Flag = 1 And bComm,
     NoPubRev,
     IsBlank('Marketing Used ') And bComm,
     bComm
     )
     ), 
     DateFormReceived,
     Descending
     )
    )

    Happy to explain the logic.

     

     

  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @RPeck ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • RPeck Profile Picture
    4 on at

    @WarrenBelz , I apologize for my late reply.  Thank you for your assistance.  Unfortunately, my PowerApp does not like this formula.  I think if we could go through the logic, I might be able to identify where I am going wrong.  

     

    As you can see in the attached image, the field Q_6A_Comments is not being recognized.

    New Formula.PNG
  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    @RPeck ,

    That was your exact code I used - I assume it worked in the code you supplied. I will give you another syntax, but you may need to check your control values and names

    With(
     {
     bComm:
     !IsBlank(Q_6A_Comments) || !IsBlank(Q_12A_Comments) ||
     !IsBlank(Q_10A_Comments) ||!IsBlank(Q_9A_2016_Comments),
     PubRev: MayPublishComments.Value = true && NotReviewed.Value = true,
     PubNoRev: MayPublishComments.Value = true && NotReviewed.Value = false,
     NoPubRev: MayPublishComments.Value = false && NotReviewed.Value = true
     },
     Sort(
     Filter(
     'AtNeed Complete v2S',
     If(
     PubRev,
     bComm && Q_12C_Flag = 1 && IsBlank('Marketing Used '),
     PubNoRev,
     Q_12C_Flag = 1 && bComm,
     NoPubRev,
     IsBlank('Marketing Used ') && bComm,
     bComm
     )
     ), 
     DateFormReceived,
     Descending
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • RPeck Profile Picture
    4 on at

    I think that the first formula you provided to me will work, but it is acting as if it does not know which entity to pull the data from, if that makes sense.  My original formula does work (although incorrectly).  

     

    I am not familiar with using the With() formula and need help determining where to tell it to pull from data source AtNeedCompleteV2s.

     

    Thank you again.

  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Thanks @RPeck ,

    With() is doing nothing more than setting (very) temporary variables to use in the Filter and saves typing the formula in multiple times. The ones below

    With(
     {
     bComm:
     !IsBlank(Q_6A_Comments) || !IsBlank(Q_12A_Comments) ||
     !IsBlank(Q_10A_Comments) ||!IsBlank(Q_9A_2016_Comments),
     PubRev: MayPublishComments.Value = true && NotReviewed.Value = true,
     PubNoRev: MayPublishComments.Value = true && NotReviewed.Value = false,
     NoPubRev: MayPublishComments.Value = false && NotReviewed.Value = true
     },

    will all produce Boolean (true/false) outputs, so when you refer to them in the filter (as an example saying If(bComm . . . ), every time it is referenced, you are saying
    Q_6A_Comments is blank OR Q_12A_Comments is blank OR Q_10A_Comments is blank OR Q_9A_Comments is blank.

    You could type this in every time and have huge formula with the same effect.

    So look at your filter and every time you see one of the four references in the With statement, replace it with the relevant formula

    Sort(
     Filter(
     'AtNeed Complete v2S',
     If(
     PubRev,
     bComm && Q_12C_Flag = 1 && IsBlank('Marketing Used '),
     PubNoRev,
     Q_12C_Flag = 1 && bComm,
     NoPubRev,
     IsBlank('Marketing Used ') && bComm,
     bComm
     )
     ), 
     DateFormReceived,
     Descending
    )

    With this in mind, see if the filter makes sense on your data and if it will get the results.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • WarrenBelz Profile Picture
    156,526 Most Valuable Professional on at

    Hi @RPeck ,

    Just checking if you got the result you were looking for on this thread. Happy to help further if not.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard