A counter or index is often needed when you are iterating over multiple elements. Within Power Automate you can increment a variable in your flow. There is even a dedicated action for incrementing variables within Power Automate. Within this article I will show you in a simple example how to use the increment action step by step.
Step by Step: How To Increment A Variable With Power Automate
-
Create a new Microsoft flow
Create new Flow
-
Add an “Initialize variable” step, name it “counter”, set the type to Integer and the Value to 0
Initialize variable
-
Add a “Do until” step, that will end when the counter variable has the value 3
Do until
-
Add an “Increment variable” step for your variable “counter” like this to the do until loop
Increment variable Power Automate
You might wonder, why there is Value field. By default the Power Automate Increment variable action increments the variable by 1. Here you can define if you want to increment by another value for instance by 5 (0,5,10,15 …).
Testing the Power Automate flow for incrementing a variable
When you test your flow, you can see how the counter variable increments with every iteration:
That’s how you increment a variable in Power Automate!