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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple if condition
Power Apps
Answered

Multiple if condition

(0) ShareShare
ReportReport
Posted on by 2,563

Hi I need some help getting a multiple if formula right.

 

My current formula seems to work but I'm not sure I'm writing this in the best way.

I want to show the card if the first two options are selected true. If they are not true then I will never show it.
But if the two options are true but SelectSite = MySite and SelectTrainingType = None then it should not show.
If the SelectSite and SelectTraininType is anything else it should still show.

 

The below seems to be working but again I'm I writing this in the best way?

 

If(
 varFormSection = 3 &&
 varManuallyOrImport = "Manually",
 true And If(
 SelectSite.Selected.Result = "MySite" &&
 SelectTrainingType.Selected.Result = "None", 
 false, true))

 

Categories:
I have the same question (0)
  • Jeff_Thorpe Profile Picture
    6,085 Super User 2024 Season 1 on at

    I am not sure if there is a better way but there are other ways to write it. I believe you could do this without the nest if statement. 

    Example:

    If(varFormSection = 3 && varManuallyOrImport = "Manually" && !(SelectSite.Selected.Result = "MySite" && SelectTrainingType.Selected.Result = "None"), true, false)

     

  • JimmyW Profile Picture
    2,563 on at

    @Jeff_Thorpe Thank you for helping out, the formula you provided does not work. This will show the card if SelectTrainingType is anything else then None.

     

    I want to show it if first section of criteria is meet, and I want to hide if second section of the criteria is meet

  • Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @JimmyWork ,

     

    Nested If won't matter if there's multiple attributes checked and compared.

    You can use switch statements if you are checking 1 control value multiple times with different outputs (example: dropdown items)

     

    You can try some of the formulas below,

    Formula 1: Basic nested IFs

     

    If(
     varFormSection = 3 &&
     varManuallyOrImport = "Manually",
     If(
     SelectSite.Selected.Result = "MySite" &&
     SelectTrainingType.Selected.Result = "None", 
     false, true
     )
    )

     

     

    Formula 2: Using with(). Although I haven't used this often but this saves multiple declaration of same condition if repeated.

     

    With(
     {
     varCheckValues_1: varFormSection = 3 && varManuallyOrImport = "Manually",
     varCheckValues_2: SelectSite.Selected.Result = "MySite" && SelectTrainingType.Selected.Result = "None"
     },
     If(
     varCheckValues_1,
     If(
     varCheckValues_2,
     false,
     true
     ),
     false
     )
    )
    

     

     

    Hope this helps

     

  • JimmyW Profile Picture
    2,563 on at

    @Ethan_R Thank you for answering.

    Do you see anything wrong with my formula, as it is currently working as I want to.

     

    If(
     varFormSection = 3 &&
     varManuallyOrImport = "Manually",
     true And If(
     SelectSite.Selected.Result = "MySite" &&
     SelectTrainingType.Selected.Result = "None", 
     false, true))
  • Verified answer
    Ethan_009 Profile Picture
    4,838 Moderator on at

    No @JimmyWork ,

     

    Your formula is also correct.

    I've just written it simple way as

    If(<anything compared here will give Boolean output>, <execute if output true>, <execute if output false>)

    therefore, I didn't explicitly define true And another if. 

  • JimmyW Profile Picture
    2,563 on at

    @Ethan_R Thank you so much Ethan

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard