Power Automate IF Function With Real-Time Examples

Power Automate IF Function With Real-Time Examples

No comments

Loading

In this “Power Automate IF Function” article, we will learn about what the Power Automate IF function is and how to use the IF expression in Power Automate with real-time project-based scenarios.

Power Automate, a key component of Microsoft’s Power Platform, empowers users to automate and streamline their workflows. Among its many functions, the “If” function is a powerful tool for adding conditional logic to your automation. In this article, we will explore the capabilities of  “Power Automate If function” with real-time examples to demonstrate how it can enhance your productivity and simplify complex decision-making processes.

Power Automate IF Function: Understanding the “If” Function

The “If” function in Power Automate allows you to create conditional statements based on a specific condition. These statements can be used to direct the flow of your workflow, making it dynamic and responsive to real-world situations. With the “If” function, you can automate actions that depend on whether a condition is met or not.

Syntax:

IF Function in Power Automate - Syntax
IF Function in Power Automate – Syntax

Sample Example:

if(equals(2,4),'equal','not equal')
Power Automate IF function sample example
Power Automate IF function sample example

Output:

not equal

Power Automate IF function sample example output
Power Automate IF function sample example output

Benefits of Using the If Function in Power Automate

  • Automated Decision-Making: The “If” function allows for automated decision-making based on specified conditions, reducing the need for manual intervention.
  • Efficiency: It streamlines workflows by directing actions based on the evaluation of conditions, saving time and resources.
  • Consistency: Automating decision points ensures that processes are executed consistently, reducing errors.
  • Adaptability: The “If” function makes workflows more adaptable to changing circumstances, improving responsiveness.

Power Automate IF Function: Real-Time Examples

In the below section, we will see a real-time example of an IF expression. For all demos below, we should have an instant manual trigger flow.

Check If trigger date is greater than current date

Create a trigger date input parameter. Then, add a data operation compose action, inside which pass the below expression to check whether the current date is greater than the trigger date or vice versa:

if(greater(triggerBody()['date'],utcNow()),'The triggered date is greater than the current date.','The current date is greater than the trigger date.')
Power Automate IF function - Check If trigger date is greater than current date
Power Automate IF function – Check If trigger date is greater than current date

Let’s now run this flow. Pass the trigger date as a past date.

Power Automate IF function - Check If trigger date is greater than current date demo run
Power Automate IF function – Check If trigger date is greater than current date demo run

Output:

The output will be “The current date is greater than the trigger date.”

Power Automate IF function - Check If trigger date is greater than current date demo output
Power Automate IF function – Check If trigger date is greater than current date demo output

Check If the age is greater or equal to 18 – you are eligible for voting card

Let’s say if your age is greater than or equal to 18, then you are eligible for a voting application; otherwise, you are not. To check this condition, use the below “IF Expression”:

if(greaterOrEquals(outputs('Compose_-_Enter_Age'),18), 'You are eligible for voting card.', 'You are not eligible for voting card.')
Power Automate IF condition to check age eligibility
Power Automate IF condition to check age eligibility

Output:

You are eligible for voting card.

Check If the age is greater or equal to 18
Check If the age is greater or equal to 18

Note:

  • Here, if you enter less than 18 age, you will get this output “You are not eligible for voting card.”

Check null value in SharePoint List using IF condition

Create a SharePoint List or Document library.

Check null value in SharePoint List using IF condition
Check null value in SharePoint List using IF condition

I have this employee list where I have a couple of employees with designations, and for one employee, the designation value was intentionally kept as empty. Now I will show you how to handle the null value in Power Automate using the “IF expression”.

Add a “Get Items’ action where you pass your site address and list name. Inside the “Apply to each” loop, add “Designation” is equal to “null”, and we will get the empty designation.

Check null value in SharePoint List using IF condition Expression
Check null value in SharePoint List using IF condition Expression

Demo: Output

Check null value in SharePoint List using IF condition Expression Demo Output
Check null value in SharePoint List using IF condition Expression Demo Output

Power Automate Conditional Trigger Flow using IF expression

We can conditionally trigger Power Automate flow using the “IF expression”, Refer to my previous article on how to conditionally trigger Power Automate flow using the “IF expression”.

Summary: IF Function in Power Automate

Thus, in this article, we have learned about how to work with the Power Automate IF function with real-time project scenario-based examples.

Power Automate’s “If” function is a versatile tool for adding conditional logic to your workflows. As demonstrated in the real-time examples, it can be used in various scenarios, from employee leave approval to expense management and task assignment. By automating decisions, you can streamline your workflows, enhance efficiency, and reduce errors. The “If” function is a valuable asset for improving your productivity and optimizing your processes. Start utilizing it to simplify complex decision-making in your workflows today.

See Also: Power Platform Articles

You may also visit the Power Platform article hub, where you will see a bunch of articles focusing on Power Platform, like Power Automate, Power Apps, etc. All the articles are written with real-time project scenarios and troubleshooting techniques. For the Power Automate function references, you may refer to this Microsoft Power Automate Function references  article.

 

About Post Author

Do you have a better solution or question on this topic? Please leave a comment