Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Reduce the number of variables in your Power Automate flow

Posted on November 26, 2023April 28, 2025 by Tom

“I’ve got so many variables in my Power Automate flow, so many ‘Initialize variable’ actions, can I somehow reduce their number?”


When you need a variable in a Power Automate flow, you must initialise it with an action – one variable, one action. An action that must be at the top level, meaning you can’t initialise it only when you need it. So you initialise it right away, at the beginning of the flow. A smaller or bigger series of ‘Initialize variable’ actions to prepare all of them.

While it’s not that bad, I don’t like having many variables in a flow. It’s annoying to initialise them, it makes the flow longer than necessary, they make it harder to copy/paste parts of the flow, and they create a mess among dynamic content as they stay always at the top.

This article will be about reducing their amount in a flow.

Using existing dynamic contents?

Since every Power Automate action gives you an output, there’s often no need to even have a variable. If all your variable does is storing some output value, you don’t need the variable.

Power Automate number variables

You can reference the output directly when you need it. Even if you apply some expressions on the output, you can do the same later. No need for a variable.

Storing result from a condition?

Sometimes your flow needs a ‘Condition’, something should happen in one branch, something else in the other. Here you might be again tempted to use a variable, but that’s not necessary.

If it’s just a decision, you can replace the variable with the if(…) expression.

if(equals(outputs('Get_item_-_by_ID')?['body/ApprovalStatus/Value'], 'New'), 'New', 'Other')

Again, usable when you need it, no variable necessary.

Not sure which action did run?

Similarly, if you’re running different actions in the branches, and you’re not sure which branch the flow used.

You don’t need a variable to get the output from the active action, you can use the coalesce(…) expression instead. Coalesce(…) will give you the first non-empty parameter.

coalesce(<param1>, <param2>, <param3>...)

If you use it with outputs from both the actions as parameters, it’ll return the result of the one that did run as the other one will be empty. No need for a variable.

Power Automate number variables

Appending data in a loop?

Another use for variables I’ve seen very often is appending data in a loop. In this case it’s not only useless variable, it also makes your flow slow as explained in a previous article.

Storing flow configuration in a variable?

If you’re using something repeatedly in a flow, it’s a good practice to have these items configured at the beginning of the flow. It can be the url to a SharePoint site, list names, time intervals, etc. Here I can understand the use of a variable, but not one variable per configuration item!

The whole configuration can be done using a single object variable. As used e.g. in the approval process template, instead of 7 variables you can have just one object with 7 properties.

Power Automate number variables

The values can be then accessed using an expression.

variables('<variableName>')?['propertyName']

e.g.
variables('var_flowConfig')?['SPSite']

Summary

As you can see, there’re many situations when you don’t really need a variable. Since every Power Automate action gives you its output, you can reference the output directly, often reducing the number of required variables to 0. And even if you need a variable, it doesn’t have to be 1 variable = 1 value. A single object variable can replace many variables with fixed values, making your flow much cleaner.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

2 thoughts on “Reduce the number of variables in your Power Automate flow”

  1. Mel says:
    April 30, 2024 at 9:28 pm

    I was just building a flow with So. Many. Variables and thinking there has to be a better way than this. I was able to reduce them down with a single object variable and tested it, and it worked perfectly! I added one extra piece– a note on the variable object for myself, with the expression to use so I can quickly copy and paste when I need to access the information later. Thank you for all of these!

    Reply
  2. Pingback: How to build reusable Power Automate flows

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes