Power Automate Increment Variable + 11 Examples

In this Microsoft Power Automate Tutorial, we will learn how to increment a variable in Power Automate or Microsoft flow. Apart from Power Automate Increment Variable, we will discuss the below topics:

  • Power Automate increment variable
  • Power Automate increment float variable
  • Power Automate increment date variable
  • Power Automate increment array variable
  • Power Automate desktop increment variable
  • Power Automate increment variable current date
  • Power Automate increment string variable
  • Power Automate increment variable by 1
  • Power Automate increment string variable line break
  • Power Automate increment variable in apply to each
  • Power Automate increment variable do until
  • Power Automate increment variable line break

Power Automate increment variable

In Power Automate, there is an action Increment Variable that is used to increase the existing variable. But it only works on float and integer type variables.

Let’s see how its works on Power Automate flow. Here are the following steps to implement this action on Power Automate.

Step-1:

Before creating the flow, first, we will trigger the flow manually. For this, we have to sign in with Microsoft account in Power Automate. Then click on +create > go to Instant cloud flow > select
Manually trigger a flow
.

We can see our flow is triggering manually:

Power automate increment variable
Power automate increment variable

Now we will initialize a variable. For this, click on the +New step -> search for Initialize variable -> Add it. And set the Name, type, value such as:

  • Name- varInteger
  • Type- Integer
  • Value- 60
increment variable in Power Automate
Increment variable in Power Automate

Step-2:

In the next step, we will add an action to increase the existing variable i.e. 60. For this, click on +New step > search Increment variable > add it.

Here we will call the variable name that we have initialized and set an increment value.

  • Name- varInteger
  • Value- 12

We can see it will increase the value of the variable from 60 to 72.

How to increment variable in Power Automate
How to increment a variable in Power Automate

Step-3:

Now we will assign this variable in a compose action to see the increment value:

Increment variable in Microsoft flow
Increment variable in Microsoft flow

Let’s test the flow to see how the increment variable works on the existing variable:

Incrementing variables in Microsoft flow
Incrementing variables in Microsoft flow

This is how to increment a variable in Power Automate.

Read Microsoft flow Send an email showing wrong time for SharePoint list column

Power Automate increment float variable

Now we will see how to increase a float value in Power Automate. Let’s initialize a float type variable in Power Automate or Microsoft flow and set a value on it.

  • Name- varFloat
  • Type- Float
  • Value- 52.4
Power Automate increment float variable
Power Automate increment float variable

Similarly, add an action to increase the varFloat(initialized variable) i.e. Increment variable. Set the name and give a value such as:

  • Name- varFloat
  • Value- 2.35
Increment float variable Power Automate
Increment float variable Power Automate

Now we will call this variable(varFloat) in a Compose action to see the increment value of the assigned variable.

How to increment float variable in Power Automate
How to increment float variable in Power Automate

Let’s run this flow to see the increasing float variable. It will increase the value from 52.4 to 54.75.

Incrementing float variable in Power Automate
Incrementing float variable in Power Automate

This is how to increment a float variable in Power Automate.

Read How to get manager email or name in Microsoft Flow

Power Automate increment date variable

After incrementing integer and float type variables, here we will see how to increment a date variable in Power Automate. Here are the following steps:

Step-1:

Before creating the flow, we will trigger the flow manually and also add a date input to insert a dynamic date by clicking on +Add an input. For example:

power automate increment date variable
power automate increment date variable

Step-2:

Then we will use this date as a variable by initializing it.

Click on the +Next step > Initialize variable and set it as a String type.

Increment date variable Power Automate
Increment date variable Power Automate

Step-3:

To increment this date variable, we are going to use an expression on a Compose action.

addDays(triggerBody()['date'],10,'yyyy-MM-dd')

The above expression will return a date that adds 10 days to the inserted date. For example, if we insert 2021-11-15 then it will return 15+10 = 25 (2021-11-25).

In Compose, click on expression and insert the above formula in the formula bar, then select update.

increment date variable in Power Automate
increment date variable in Power Automate

Now our flow is ready to run. Let’s run the flow to see the result:

How to increment a date variable in Power Automate
How to increment a date variable in Power Automate

This is how we can increment a date variable in Power Automate.

Read Microsoft Flow Example: Product Notification Approval Flow

Power Automate increment variable current date

Now we will see how to increment the current date variable in Power Automate. Let’s take the previous flow example to implement this.

First, we will remove the date input from the trigger. Then initialize a string type variable and set a value such as:

  • Name– varDate
  • Type– String
  • ValueutcNow() (used in expression to give current date)
power automate increment variable current date
power automate increment variable current date

To increment the current date we will use the below expression on a compose action.

addDays(variables('varDate'),10,'yyyy-MM-dd')
Increment variable current date in power automate
Increment variable current date in power automate

We can see the date got increased from 2021-12-08(current date)to 2021-12-18.

How to increment variable current date in Power Automate
How to increment the current date variable in Power Automate

This is how to increment the current date variable in Power Automate.

Read SharePoint auto generate column value using Power Automate or Flow

Power Automate increment array variable

Now we will see how to increment an array variable in Power Automate. For example, we have an array i.e. [10,20,30,40,50] and we want to increment this array item from 50 to 55 i.e. [10,20,30,40,55].

The following steps are:

Step-1:

After triggering the flow manually, we will add an action i.e. Initialize variable to initialize the array variable.

  • Name- VarTest
  • Type- Array
  • Value- [10,20,30,40,50]
power automate increment array variable
power automate increment array variable

Step-2:

Again we will add 2 initialized variable actions into the flow. One is used to create the index of the array and another one is used to store the array variable in one-to-one correspondence.

  • Name– VarIndex
  • Type- Integer

Again,

  • Name- VarIncrese
  • Type– Array
increment array variable in Power Automate
Increment array variable in Power Automate

Step-3:

Next, we will add a loop action i.e. Apply to each and use the ‘VarTest‘ variable as the output from the previous step. Inside this loop, we will add the action to incrementing i.e. Increment Variable.

Click on +Add an action > Increment variable.

  • Name- VarIndex (select from the intialized variable)
  • Value– 1
How to increment array variable in Power Automate
How to increment array variable in Power Automate

Inside this loop (under the Increment variable), we will add another action i.e. Append to array variable.

Click on +Add an action > Append to array variable and set the action such as:

  • Name- VarIncrese(select from intialized variables)
  • Value-
{
"Index": @{variables('VarIndex')},
"Value": @{items('Apply_to_each')}
}
power automate increment a specified array variable
power automate increment a specified array variable

Step-4:

Then we will add action i.e. Set variable, outside the loop to set the variable.

Click on +Next step > search for Set variable > add it to the flow.

  • Name– VarTest(select from the initialized variables)
  • Value– []
Microsoft Flow increment an specified array variable
Microsoft Flow increment a specified array variable

Step-5:

Now we will add another Apply to each loop and use the varIncrease as output from the previous step.

Inside this loop, we will add a Condition action to check the index value. As per our condition, we will modify the 5th index(item) of the array value from 50 to 55.

For this, we will use the below expression equal to 5.

items('Apply_to_each_2')['Index']
Increment array variable in Microsoft flow
Increment array variable in Microsoft flow

If the condition will satisfy then it will move to the If yes section and add 5 to the 5th item of the array variable. In the If yes part, we will add:

  • Name- VarTest
  • Value- (below expression)
add(items('Apply_to_each_2')['Value'],5)

Otherwise (in the If no), it will show only the value of the item.

  • Name– VarTest
  • Value– (below expression)
items('Apply_to_each_2')['Value']
Modifying a single element of an array in Power Automate
Modifying a single element of an array in Power Automate

And finally, we will use this variable in a compose action to see the increment value of the array:

Power Automate Modifying a single element of an array
Power Automate Modifying a single element of an array

Let’s run the flow to see the increment value:

power automate increment a single element of array variable
power automate increment a single element of an array variable

This is how to increment an element of an array variable in Power Automate.

Read PowerApps upload file to SharePoint document library

Power Automate desktop increment variable

Now we will see how to increment a variable using Power Automate Desktop flow. The following steps are:

Step-1:

Let’s open the Power Automate Desktop application. Then click on +New Flow and give a name.

On the left-side, we can see in the Action pane > Click on Variables.

Power Automate Desktop variable
Power Automate Desktop variable

From these variable actions, drag the Set variable to the workspace(Main screen). Then set a variable’s name and value. Click Save.

  • Set– VarNumber
  • To- 50
power automate desktop increment variable
power automate desktop increment variable

Step-2:

To increase this variable, next, we will drag the Increase variable action to the workspace. In select parameter,

  • Variable Name- %VarNumber% (select the variable by clicking on {X} symbol)
  • Increase by- 35
 Increment variable in power automate desktop
Increment variable in power automate desktop

Step-3:

To display the increment value, let’s drag the Display message from the Action panel. Set the properties like below:

  • Message box title: Result(Give any name)
  • Message to display: %VarNumber%
Incrementing variables using Power Automate Desktop
Incrementing variables using Power Automate Desktop

Let’s save and run the flow to see the increment value. The result will come in a pop-up message:

How to increment a variable in Power Automate Desktop
How to increment a variable in Power Automate Desktop

This is how to increment a variable in Power Automate Desktop.

Also read, Power Automate Delete all items in SharePoint list

Power Automate increment string variable

In this example, we will see how to increment a string variable in Power Automate flow. For this, first, we need to initialize a string variable.

click on +Next step > Initialize Variable > Add this action into the flow. Set the parameters like below:

  • Name- VarString
  • Type- String
  • Value-55
Power Automate increment string variable
Power Automate increment string variable

Next, we will add a Compose action to convert this string value to an Integer by using an expression:

int(variables('VarString'))

Again add another compose action to increment the string variable, using the below expression. For example, we will add 20.5 in the string variable( i.e. 55).

add(20.5,outputs('Compose'))
Increment string variable in Power Automate
Increment string variable in Power Automate

Let’s run this flow to see the string value increment from 55 to 75.5:

How to increment a string variable in Power Automate
How to increment a string variable in Power Automate

This is how to increment a string variable in Power Automate.

Read Run Flow on a Schedule in Power Automate

Power Automate increment variable by 1

Here we will see how to increment a dynamic variable by 1 in Power Automate. To implement this, we will add a number input inside the trigger(i.e. Manually trigger the flow).

Click on +add an input > select Number

Power Automate increment variable by 1
Power Automate increment variable by 1

In the next step, we will initialize an integer type variable.

Click on +Next step > Initialize variable(search for the action) > Add it. Set the properties such as:

  • Name- VarNumber
  • Type- Integer
  • Value- @{triggerBody()[‘number’]}
Incrementing variable by 1 in Power Automate
Incrementing variable by 1 in Power Automate

After initializing, we will add an action to increment the variable by 1.

Click on +Next step > Increment variable > Add it, where we will set the parameters such as:

  • Name- VarNumber
  • Value- 1
How to increment variable by 1 in Power Automate
How to increment variable by 1 in Power Automate

Now we will use this variable in a compose action to see the increment value.

How to increment variable by 1 in Power Automate
How to increment variable by 1 in Power Automate

Now our flow is ready to run. While running, it will ask to insert a number(any dynamic input). Let’s insert a number as 23 > click on Run flow.

Microsoft Flow increment local variable by 1
Microsoft Flow increment local variable by 1

We can see the value incremented by 1 i.e. 24.

increment variable by 1 in Power Automate
increment variable by 1 in Power Automate

This is how to increment variables by 1 in Power Automate.

Read Power Automate SharePoint Get items filter query contains is not valid

Power Automate increment variable in apply to each

Here, we will see how to increment a variable in Apply to each loop using Power Automate flow.

For example, we have an array having null value such as [1,1,null,2,null,3]. Now we will calculate this array in Power Automate by looping and incrementing the total variable by another field value. Let’s start the calculation and the following steps are:

Step-1:

First, we will initialize an array variable using above value.

  • Name- VarArray
  • Type- Array
  • Value- [1, 1, null, 2, null, 3]
Power Automate increment variable in apply to each
Power Automate increment variable in apply to each

Step-2:

Again, we will add another action to initialize the integer variable. Set the properties such as:

  • Name- VarTotal
  • Type- Integer
  • Value- 0
increment variable in apply to each In Power Automate
increment variable in apply to each In Power Automate

Step-3:

Next, we will add an action for looping the array value.

Click on +Next step > Apply to each. In this action, we will use the VarTotal as output.

  • Select an output from previous steps– VarTotal

Inside that loop, we will use another action to calculate the increment of array variable i.e. Increment variable flow action.

  • Name- VarTotal
  • Value- @{items(‘Apply_to_each’)} (search for current item in dynamic content)
increment variable in apply to each in Flow
increment variable in apply to each in Flow

Now our flow is ready to run. As we know, null means 0. But the increment variable action indicates the value of 1 where the increment by parameter is not given i.e. the null value.

Note:

According to Array it will calculate as:

1=1
1+1=2
2+null(1)=3
3+2=5
5+null(1)=6
6+3=9
How to increment a variable in Power Automate using Apply to each
How to increment a variable in Power Automate using Apply to each

But we can use the null value as 0 in the increment variable action by using this expression instead of using current items.

coalesce(items('Apply_to_each'),0)

Note:

The coalesce() returned the first non-null object in the arguments passed in.

Microsoft Flow increment variable using Apply to each
Microsoft Flow increment variable using Apply to each

The final result comes as:

1=1
1+1=2
2+null(0)=2
2+2=4
4+null(0)=4
4+3=7
 increment variable in apply to each using Flow
increment variable in apply to each using Flow

This is how to increment a variable in apply to each loop using Power Automate flow.

Read Power Automate copy list item to another list with attachments

Power Automate increment variable do until

Sometimes, we repeat certain steps to meet the condition. In that situation, we need to use the ‘do until‘ loop in our flow. Here we will see how to use increment variable in Power Automate using do until loop.

For example, we will calculate a counter value that will increment by 2 till it becomes 10. The following steps are:

Step-1:

After triggering the flow manually(we described the procedure in the above example), we will add an action to initialize an integer variable.

Click on +Next step > Initialize variable action. Set the properties like below:

  • Name- VarCount
  • Type- Integer
  • Value- 0
power automate increment variable until
power automate increment variable until

Step-2:

Next, we will use the ‘Do until‘ control action to create a loop till the value becomes 10.

Click on +Next step > Condition > Do until control

Set the parameter like below:

  • Choose a value – VarCount
  • Condition- Is equal to
  • Value- 10
power automate increment variable do until
Power automate increment variable do until

Step-3:

Inside the loop, we will use the increment variable action for incrementing the value.

Click on +Add an action > Increment variable > Add this action to the flow. Also, set the properties:

  • Name- VarCount
  • Value- 2
Usage of Do until in Power Automate Increment variable
Usage of Do until in Power Automate Increment variable

Now save and run the flow to see the result. It will come as 2, 4, 6, 8, 10.

Do Until Loop Control Action in Power Automate increment variable
Do Until Loop Control Action in Power Automate increment variable

Note:

You can see the result by clicking on Next.

This is how to use the Power Automate increment variable in Do-until control.

Read Power Automate flow with Microsoft teams

Power Automate increment variable line break

Here we will see how to use a line break in the string variable in Power Automate.

For example, let’s initialize a string variable having multiple values using commas in a single line.

Click on +Next step > Initialize variable. Set the properties like:

  • Name- VarString
  • Type- String
  • Values- USA, CANADA, UAE, UK
power automate increment variable line break
power automate increment variable line break

When we run this flow, it will show the result as USA, CANADA, UAE, UK like below:

Increment variable line break power automate
Increment variable line break power automate

But as per requirement, we want to use a line break inside the value. To implement this, we will insert values using enter(one by one).

USA,
CANADA,
UAE,
UK
using line break in a string variable in Power Automate
using line break in a string variable in Power Automate

Let’s run the flow, to see the result. Also, we can see it is consists \n for creating a new line or linebreak in the raw output.

This is how to use a line break inside the string variable in Power Automate.

Related Power Automate tutorials:

Conclusion

From this Power Automate Tutorial, we discussed the Increment variable in Power Automate flow. Also, we discussed:

  • How to use Power Automate increment variable action?
  • How to increment a float variable in Power Automate?
  • How to increment a dynamic date variable in Power Automate?
  • How to increment a current date variable in Microosft flow?
  • How to increment array variable in Power Automate?
  • How to increment a variable using Power Automate Desktop flow?
  • How to increment a string variable in Power Automate?
  • How to increment a variable by 1 in Power Automate?
  • How to use a line break in string variable in Power Automate?
  • How to use increment variable in apply to each in Power Automate?
  • How to use an increment variable action do until loop?
>