Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Save formulas in variable


I have formulas i want to use in every screen. To reduce the management work I want to have those formulas saved in a variable OnStart and use that variable every time. But if I use that variable PowerApps expects always something else. How can i fix this? Thanks!

Level 10

Re: Save formulas in variable

Hi @Oos 


Unfortunately you can't reuse code in the way that you are trying to achieve.


The best way that we have used to reuse code, is to put them in Toggles. You put the code you want to trigger in the Toggle OnCheck property, while you specify the condition when to trigger the formula in the Default Property to return True or False.  You can then 'call' the togge ot trigger by setting variables or collections to make the toggle return true or false.


Below is a video where @ToddBaginski is showing off this functionality with error handling. You can however use this method for most other logic in the apps as well.


Let me know if you don't come right.


Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube:
**If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions.



Level: Powered On

Re: Save formulas in variable

I had a similar requirement. I opened a idea on powerapps. Kindly vote for it so that we get this feature in upcoming release.


Hope this helps,


Community Support Team
Community Support Team

Re: Save formulas in variable

Hi @Oos ,

Do you want to save your formulas into a variable for reuse in your app?


If you want to save your formulas into a variable for reuse in your app, I afraid that there is no way to achieve your needs in PowerApps currently.

When you save your formula into a variable, these formulas would be saved as Text value rather than actual formula function.


If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:


Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources


PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.


Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.


Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020


Power Platform World Tour

Coming to a city near you


PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Join PowerApps User Group!!

Connect, share, and learn with your peers year-round


Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 199 members 4,367 guests
Please welcome our newest community members: