Introduction
In Microsoft Power Apps, a User Defined Function (UDF) allows you to create your own reusable formula that can be called multiple times within your app.
Instead of writing the same formula again and again, you define it once and reuse it anywhere in the app just like built-in functions (Sum, If, LookUp, etc.).
⚡ UDFs improve readability, reusability, and maintenance of your app.
✅ 1. What is a User Defined Function?
A User Defined Function (UDF) is a custom function you create using:
FunctionName(Parameter1: Type, Parameter2: Type): ReturnType = FormulaYou define it in the App → Formulas property.
👉 App → Formulas

Steps:
Select App (top of the Tree view).
Go to the Formulas property in the formula bar.
Define your function there.
That’s the setting used to create and manage User Defined Functions in Power Apps.
👉 App → Setting
Settting -> Updates -> Experimental -> User-define types : toggle turn ON

✅ 2. Simple Example (Beginner Level)
🎯 Scenario:
You want a reusable function to calculate a 10% discount price.
🔹 Step 1: Go to
App → Formulas
Add:
CalculateDiscount(Price: Number): Number =
Price - (Price * 0.1)🔹 Step 2: Use it anywhere
CalculateDiscount(200)👉 Result: 180
Now instead of writing:
Price - (Price * 0.1)You simply call:
CalculateDiscount(Price)Much cleaner ✅
✅ 3. Medium Example – Full Name Formatter
🎯 Scenario:
You want to format a user’s full name properly.
🔹 Define function
FormatFullName(FirstName: Text, LastName: Text): Text =
Proper(FirstName) & " " & Proper(LastName)🔹 Use it
FormatFullName("Ketan", "Sathavara")👉 Output: Ketan Sathavara
✅ 4. Long Real-World Example (Advanced Business Case)
🎯 Scenario
You’re building a Sales Management App.
You need to calculate commission based on sales amount and role.
💼 Commission Rules
| Role | Condition | Commission |
|---|---|---|
| Manager | Any | 15% |
| Senior | Sales > 10,000 | 12% |
| Senior | Sales ≤ 10,000 | 8% |
| Junior | Any | 5% |

Join the conversation! Your thoughts help the community grow.