Post

#PowerPlatformTip 101: 'Centralized Data Handling'

#PowerPlatformTip 101: 'Centralized Data Handling'

TL;DR: Centralize Power Apps logic with global variables and Named Formulas so you maintain it in one place instead of duplicating it across buttons and screens.

💡 Challenge

You need the same piece of logic, say, resolving a supervisor’s email from the current user, in several places across your app. Embedding it in every button and screen leads to duplication that’s hard to keep in sync.

✅ Solution

Store the input once in a global variable and derive everything else with Named Formulas. The logic lives in a single place and recalculates automatically, so buttons and screens simply reference the result.

🔧 How It’s Done

1. Store the input centrally in a global variable:

🔸 Set(gvUserEmail, User().Email), e.g. in App.OnStart.

2. Derive dependent values with a Named Formula (App → Formulas):

🔸 nfSupervisorEmail = LookUp(Employees, Email = gvUserEmail).SupervisorEmail;

🔸 It recalculates automatically whenever gvUserEmail changes.

3. Reuse the pattern for other logic (e.g. filtering):

🔸 nfMyRecords = Filter(Projects, Owner = gvUserEmail);

🔸 Reference the Named Formulas anywhere instead of repeating the expression.

🎉 Result

A centralized data-handling setup in Power Apps that eliminates duplicated logic across buttons and screens, making the app easier to build and maintain.

🌟 Key Advantages

🔸 Centralizing logic reduces redundancy and complexity.

🔸 Updates happen in one place, easing maintenance.

🔸 A clear, efficient way to manage data relations and operations.

🎥 Video Tutorial

🛠️ FAQ

1. What is a Named Formula in Power Apps? Named Formulas let you define reusable expressions in your app’s global scope, so logic is maintained and updated centrally.

2. Why use global variables instead of context variables? Global variables (Set()) persist across screens, centralizing logic, whereas context variables (UpdateContext()) are local to a single screen.

3. Can I apply this centralized approach to other scenarios? Yes, data filtering, calculations, formatting and more, avoiding duplication across controls and screens.

🔸 #PowerPlatformTip 61: ‘Power of Environment Variables’ - the same centralization principle, applied to configuration that changes per environment.

🔸 The Big 5: Variables and Parameters in PowerApps - a refresher on Set() and global variables before you layer Named Formulas on top.

This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy – live Power Platform workshops, free or CHF 49. Join the workshop waitlist to get notified about new dates. For companies that want this implemented for them, see KMUpower – Power Platform consulting & automation for SMEs (DACH).

This post is licensed under CC BY 4.0 by the author.

Microsoft and the Power Platform product names (for example Power Apps, Power Automate, Copilot Studio) are trademarks of the Microsoft group of companies. This is an independent website. It is not operated, sponsored or endorsed by Microsoft.