cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Multiple IF Statements

Hi Guys,

 

I'm confused about this if statement, does anyone knows how to apply the IF statement on this scenario?
If the requestor request for amount 0 - 100,000 the approver is the TL/MANAGER

if the amount is 100,001 - 500,000 the approver is the VP/AVP

if the amount is 500,000 - 1,000,000 the approver is the COO and CFO

if the amount is 1,000,000 above the approver is the president

 

currently, this is the old formula I want to update the formula to the scenario above

If(
Value(TotalAmount_4.Text) >= 500000,
Office365Users.UserProfile("president.president@president.ph").DisplayName,
Value(TotalAmount_4.Text) >= 100000,
If(
User().Email = "riella.guioguio@rafi.ph",
Office365Users.UserProfile("president.president@president.ph").DisplayName,
Office365Users.UserProfile("CFO.CFO@CFO.ph").DisplayName
),
Office365Users.UserProfile(Label40.Text).DisplayName
)

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Multiple IF Statements

@Big_S 

This structure should work

If(
    Value(ApprovalAmt.Text) <= 100000,
    "TL/MANAGER",
    Value(ApprovalAmt.Text) > 100000 && Value(ApprovalAmt.Text) <= 500000,
    "VP/AVP",
    Value(ApprovalAmt.Text) > 500000 && Value(ApprovalAmt.Text) <= 1000000,
    "COO and CFO",
    Value(ApprovalAmt.Text) > 1000000,
    "President"
)

Where I have "TL/MANAGER", "VP/AVP" ... you will just need to add in your relevant User code, eg

Office365Users.UserProfile("president.president@president.ph").DisplayName

 

Also, I have a textInput called ApprovalAmt, just replace this with the name of your textinput control.

 

Let me know how you get on.

 

View solution in original post

Highlighted
Super User II
Super User II

Re: Multiple IF Statements

@Big_S 

You can just use a Concatenate function for this, ie

 

Replace this:

Office365Users.UserProfile("COO.COO@email.ph").Mail

 

With this:

Concatenate(
     "Both must approve: ", 
     Office365Users.UserProfile("COO.COO@email.ph").Mail, " and ", 
     Office365Users.UserProfile("CFO.CFO@email.ph").Mail
)

Notes:

 - adjust Office365Users.UserProfile("CFO.CFO@email.ph").Mail to suit your needs, I've just had a guess at what it might be 🙂

 - you can remove both "Both must approve: " and the " and " parts if you wish, I just added them for effect.

 

View solution in original post

8 REPLIES 8
Highlighted
Super User II
Super User II

Re: Multiple IF Statements

@Big_S 

This structure should work

If(
    Value(ApprovalAmt.Text) <= 100000,
    "TL/MANAGER",
    Value(ApprovalAmt.Text) > 100000 && Value(ApprovalAmt.Text) <= 500000,
    "VP/AVP",
    Value(ApprovalAmt.Text) > 500000 && Value(ApprovalAmt.Text) <= 1000000,
    "COO and CFO",
    Value(ApprovalAmt.Text) > 1000000,
    "President"
)

Where I have "TL/MANAGER", "VP/AVP" ... you will just need to add in your relevant User code, eg

Office365Users.UserProfile("president.president@president.ph").DisplayName

 

Also, I have a textInput called ApprovalAmt, just replace this with the name of your textinput control.

 

Let me know how you get on.

 

View solution in original post

Highlighted
Helper V
Helper V

Re: Multiple IF Statements

Hi @Eelman 

 

Thank you for this, I will execute this and update you with the result.

 

Thank you so much 🙂

Highlighted
Helper V
Helper V

Re: Multiple IF Statements

Hi @Eelman ,

 

IT WORKS!!! :), however, how can I display multiple people in a Label? 

 

The box was a Label

 

Approver: 

CFO,COO
 

This is the formula I applied

If(
Value(TotalAmount_4.Text) <= 100000,
LookUp('[dbo].[Employee]',EmployeeEmail=Label11.Text, ApproverEmail),
Value(TotalAmount_4.Text) > 100000 && Value(TotalAmount_4.Text) <= 500000,
LookUp('[dbo].[Employee]',EmployeeEmail=Label11.Text, ApproverEmail),
Value(TotalAmount_4.Text) > 500000 && Value(TotalAmount_4.Text) <= 1000000,
Office365Users.UserProfile("COO.COO@email.ph").Mail, How can I add the email of CFO here as approver?
Value(TotalAmount_4.Text) > 1000000,
Office365Users.UserProfile("president.president@email.ph").Mail
)

Highlighted
Super User II
Super User II

Re: Multiple IF Statements

@Big_S 

You can just use a Concatenate function for this, ie

 

Replace this:

Office365Users.UserProfile("COO.COO@email.ph").Mail

 

With this:

Concatenate(
     "Both must approve: ", 
     Office365Users.UserProfile("COO.COO@email.ph").Mail, " and ", 
     Office365Users.UserProfile("CFO.CFO@email.ph").Mail
)

Notes:

 - adjust Office365Users.UserProfile("CFO.CFO@email.ph").Mail to suit your needs, I've just had a guess at what it might be 🙂

 - you can remove both "Both must approve: " and the " and " parts if you wish, I just added them for effect.

 

View solution in original post

Highlighted
Helper V
Helper V

Re: Multiple IF Statements

Hi @Eelman 

 

Yes, you're right both must approve 🙂

 

However I have a Label that would display the name of the approvers, how can I display both names of COO and CFO? right now only the COO displayed the name as the approver

Approver :

CFO, COO

 


I have updated the formula to this

 

If(
Value(TotalAmount_4.Text) <= 100000,
LookUp('[dbo].[Employee]',EmployeeEmail=Label11.Text, ApproverEmail),
Value(TotalAmount_4.Text) > 100000 && Value(TotalAmount_4.Text) <= 500000,
LookUp('[dbo].[Employee]',EmployeeEmail=Label11.Text, ApproverEmail),
Value(TotalAmount_4.Text) > 1000000,
Office365Users.UserProfile("president.president@email.ph").Mail,
Value(TotalAmount_4.Text) > 500000 && Value(TotalAmount_4.Text) <= 1000000,
Office365Users.UserProfile("COO.COO@email.ph").Mail,
Office365Users.UserProfile("CFO.CFO@email.ph").Mail
)

 

 

 

Highlighted
Helper V
Helper V

Re: Multiple IF Statements

I think I missed something let me check once again

Highlighted
Helper V
Helper V

Re: Multiple IF Statements

now it works! WOHOOOOO!!!! THANK YOU SO MUCH @Eelman  🙂

Highlighted
Super User II
Super User II

Re: Multiple IF Statements

@Big_S no worries, glad to see you got it working.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,255)