In this Power Automate Tutorial, we will discuss how to Initialize a Variable on Power Automate. We will see everything on Power Automate Initialize Variable. Also, we will discuss the below topics:
- Power Automate Variable
- Power Automate Initialize Variable type
- How to initialize variable in Power Automate
- Power Automate Initialize Variable Array
- Power Automate appending to an Array
- Power Automate Initialize Variable date
- Power Automate Initialize Variable Perfoming Operation
- Power Automate Initialize Variable float
- Power Automate Initialize empty Variable
- Power Automate Initialize variable Apply to each
- Power Automate Initialize Variable boolean
- Power Automate Initialize Variable in condition
Variable in Power Automate
Before initializing a variable on Power Automate, first, we will know what is variable on Power Automate.
In Power Automate, a variable is just like temporary storage where we can store the data in any data type such as integer, float, boolean, string, array, and object. After initializing the variable, we can use this to perform such tasks:
- Get or reference the variable’s value
- Increment or decrement the variable’s by constant value
- Asign the different value to the variable
Power Automate Initialize Variable type
There are various data types those are provided by Power Automate; such as:
- String- It is used as text input i.e. hello, SharePoint, etc.
- Boolean- Here the value can be either true or false.
- Float- It acepts the numeric data type that has decimal i.e. 45.23, 78.3, etc.
- Number– It accepts only numerical data type i.e. 60, 25, etc
- Object- It contains the pair of properties and value that are in JSON format.
- Array- It is to input as list of objects which must be a similar datatype.
Read SharePoint auto generate column value using Power Automate or Flow
How to initialize variable in Power Automate
Before using a variable in Power Automate, first, we will see how to initialize the variable in Power Automate. For this, follow this step-by-step guide.
Step-1:
Go to Instant cloud flow, then select the trigger to start the flow i.e. Manually trigger a flow.

Step-2:
Now we will add an action to initialize the variable i.e. initialize variable. We can find 3 parameters under that action such as:
- Name– Here we have to give a name to our variable.
- Type– Here we have to define the data type of the varriable that we want to assign.
- Value– Here we can give a value either a constant value or a dynamic value.

Step-3:
Now we will add a compose action to get the output from the input(from variable). But we can’t change the original input in compose.

When we run the flow, we can see the output on Compose:

This is how to initialize variables with string data types on Power Automate.
Read Save my email attachments to a SharePoint document library Power Automate or Flow
Power Automate Initialize Variable Array
Now we will see how to initialize the variable with the Array data type on Power Automate.
Let’s say we have an array i.e. [Chicago, New York, Los Angeles, Texas, California]. We want to show this array on Power Automate. For this, we will add an action to initialize the variable. And make sure o change the data type as Array.

After initializing the array, we will add a compose action to retrieve the array on Power Automate.

We can see the array on the output of the Compose:

In the above example, we used strings in an array. Similarly, we can use integer values in an Array:

We can see the output is also coming as in integer data type.

This is how to initialize variables with Array data type on Power Automate.
Read PowerApps upload file to SharePoint document library
Power Automate appending to an Array
Now we will see how to append a string on an array by initializing it. For this, we are going to use the string array that we have created previously i.e. [“Chicago”, “New York”, “Los Angeles”, “Texas”, “California”].
Then, we will add the action “Append to array variable” that will append a value on the existing array variable. For example, we want to add a value i.e. Columbus on the existing array( VarArray ).

Now we will add a Compose action to get the output.

And we can see the output is coming as:
[“Chicago”, “New York”, “Los Angeles”, “Texas”, “California”, “Columbus”]

This is how to append to an Array on Microsoft flow.
Read Power Automate Delete all items in SharePoint list
Power Automate Initialize Variable date
In Power Automate, there is no “date” type to initialize the variable on Power Automate. But there is another way to initialize variables for a date on Power Automate flow.
Let’s take an example when we will insert a date it will show the output (date type) by adding the time from the existing date.
To implement this, we will add input as a Date.

Then we will add an action to initialize the variable. Here we will give a name to the variable and set the type as a string. In value, we will give an expression to adding the time on the given date-time.
addDays(triggerBody()['date'],30)

We can see if we insert today’s date then it will show the date added by 30 days.

When we will test the flow, it will ask to insert the date. For example, we will insert today’s date i.e. 10/29/2021.

Now we will run the flow to see the output(i.e. 2021-10-29 + 30 = 2021-11-28)

This is how to Initialize Variable dates on Power Automate.
Read Run Flow on a Schedule in Power Automate
Power Automate Initialize Variable Perfoming Operation
In Power Automate, we can perform various operations such as; set, increment, decrement, append on Array string and append on Array integer.
Set Operation on variable
Here we will see how to set a variable on power Automate. For this, first, we will initialize a variable type as Integer.

Then we will add another action to set the variable i.e. Set variable. Also, we will set a value to the existing variable(i.e. VarNumber).

Then we will use Compose action to get the final output.

We can see the output of VarNumber is updating from 70 to 45.

This is how to set a variable on Power Automate.
Read Power Automate shared mailbox
Decrement Operation on variable
Now we will see how to decrement a value by initializing a variable on Power Automate. To do this operation we will add an operation “Decrement variable“. There is an option to give a value, that will decrease the value from the original value of the existing variable(i.e. 45).

We can see the output is decreased from 45 to 40.

This is how to do Power Automate Initialize decrement Variable.
Read How to move files from OneDrive to SharePoint using Power Automate
Increment Operation on variable
Similarly, we can do an increment operation on the variable by using “Increment variable“. Here also, we have to insert a value that will increase the value of the last existing value( i.e. 40).

We can see the output is increased from 40 to 55.

This is how to do Power Automate Initialize Variable Performing Operation.
Read How to convert decimal to whole number in Power Automate
Power Automate Initialize Variable float
Here we will see how to initialize a variable with float data type on Power Automate. For this, first, we will initialize a variable, set the type as the float, and insert a value with decimal places.

Then we will add a Compose action to get the output as the float.

And we can see the output coming as float data type:

This is how to Initialize Variable with float data type on Power Automate.
Also read, Leave Request Approval Flow using Power Automate or Microsoft Flow
Power Automate Initialize empty Variable
In Power Automate, we can initialize a variable having a null or empty value. There is a function named null() used to initialize an empty variable on Power Automate. Now we will see how to create an empty variable on Microsoft flow.
For this, we will add the action “Initialize variable” on the flow. Here we will set the variable name and type. On the value, we will add an expression to create a null value.
null
Then we will use this variable on Compose action to check the output:

We can see there is a null value is created on the output.

We can see the empty string by clicking on the Show raw outputs.

This is how to Initialize an empty Variable on Microsoft Flow.
Check out, Power Automate Concatenate String
Power Automate Initialize Variable boolean
Now we will see how to initialize a boolean type variable on Power Automate with a suitable example.
Let’s say if 25 is greater than 20 then it returns true otherwise it returns false. To implement this, the following process is:
Step-1:
On Power Automate, to initialize a variable we will use the action “Initialize variable“. Here we will give a name to our variable, set the type as “boolean” and insert the expression according to our requirement. The expression is:
greaterOrEquals(25,20)

Step-2:
Then we will add a condition to satisfy our requirements like below:

The above flow shows that if the VarBoolean is equal to true i.e. 25 > 20, then the “If yes” will execute otherwise the “If no” will execute.
Let’s run the flow to see the result.

As 25 is greater than 20 it executes the true(the IF-yes part) value, otherwise it executes the else(the If no) part.
This is How to Initialize a Boolean Variable on Power Automate.
Also read, Power Automate convert time zone
Power Automate Initialize variable Apply to each
Apply to each is an action, that iterates all the items in a collection as similar as for loop. Now we are going to see how an apply to each loop works with Power Automate.
Step-1:
For this, first, we will create a blank list where the data will update after running the flow. For example, we will create a SharePoint list named “Equipments“.

Step-2:
Now on Power Automate, we will add the action “Initialize variable“. On that, we will give a name to the variable, set the type as Array, and give an array value.
For example, we will use an array having value as:
["Mobile", "TV", "Desktop", "Laptop", "Tab"]

Step-3:
Then we will add “Apply to each” from Control action. Here we will add the output of the variable that we initialized i.e. VarEquipments.

Also, in that action, we will add another action “create item(SharePoint)”. Here it will ask to give the Site address, list name, title. In title, we will put the “current item(apply to each)” from dynamic content.

Now our flow is ready to run. We will save it and test it. After running successfully we can see the records from the array-variable for each item, which is automatically created in our sharePoint list.

This is how to use Power Automate Initialize Variable in apply to each control.
Read Microsoft flow change true to yes
Power Automate Initialize Variable in condition
Here we will see how to use if-else condition on Power Automate by initializing a variable. For example, we want to show the result of a student whether it is grade A or grade B on the basis of Total mark.
If the total mark is greater than or equal to it will be gradeA otherwise it will be gradeB.
To apply this, on power Automate we will trigger the flow manually, and also, we will use a number field as an integer.

Then we will add a Condition(control) action, where we will check conditions as per our requirements. like below:

The above flow shows that, if the TotalMark is greater than or equal to 75 then it will execute the If yes part i.e. Grade A. Similarly, if the TotalMark is less than 75 then it will execute the If no part i.e. Grade B. For example, we will insert 65 as TotalMark.

This is how to Initialize Variable in condition on Power Automate.
Download Flow
You can also download the flow and test it.
Check out previous Microsoft flow or Power Automate articles:
- Microsoft flow Send an email showing wrong time for SharePoint list column
- How to get manager email or name in Microsoft Flow
- Create a Custom Document Template from SharePoint List using Microsoft Flow
- Microsoft Flow Example: Product Notification Approval Flow
- Microsoft flow copy list items to another list
- Power Automate Number Format
- Power Automate Trigger Conditions
Conclusion
From this Power Automate Tutorial, we learned all about Initialize variable on Power Automate. Also, we discussed:
- What is Variable in Power Automate?
- Discuss the Initialize Variable types on Power Automate?
- How to initialize variable on Microsoft Flow?
- How to Initialize arrayVariable on Power Automate?
- How to appending to an Array on Microsoft Flow?
- How to Initialize date type Variable on Microsoft Flow?
- Perfoming Operation by Initialize Variable on Microsoft Flow?
- How to Initialize float Variable on Power Automate?
- How to Initialize empty Variable on Microsoft flow?
- How to Initialize Variable as boolean type on Power Automate?
- How to use apply to each controller using Variable in Power Automate?
- Apply a condition by using variable on Power Automate?
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com